@@ -1211,6 +1211,9 @@ def test_set_page_label(pdf_file_path):
12111211 ValueError , match = "if given, start must be equal or greater than one"
12121212 ):
12131213 writer .set_page_label (0 , 5 , "/r" , start = - 1 )
1214+ del writer
1215+ import gc
1216+ gc .collect ()
12141217
12151218 pdf_file_path .unlink ()
12161219
@@ -1234,6 +1237,9 @@ def test_set_page_label(pdf_file_path):
12341237 writer .set_page_label (0 , 1 , "/A" )
12351238 writer .write (pdf_file_path )
12361239 assert PdfReader (pdf_file_path ).page_labels [: len (expected )] == expected
1240+ import gc
1241+ gc .collect ()
1242+ del reader
12371243
12381244 pdf_file_path .unlink ()
12391245
@@ -1477,6 +1483,7 @@ def test_update_form_fields(tmp_path):
14771483 )
14781484
14791485 writer .write (write_data_here )
1486+ del writer
14801487 reader = PdfReader (write_data_here )
14811488 flds = reader .get_fields ()
14821489 assert flds ["CheckBox1" ]["/V" ] == "/Yes"
@@ -1498,6 +1505,9 @@ def test_update_form_fields(tmp_path):
14981505 assert all (x in flds ["CheckBox1" ]["/_States_" ] for x in ["/Off" , "/Yes" ])
14991506 assert all (x in flds ["RadioGroup1" ]["/_States_" ] for x in ["/1" , "/2" , "/3" ])
15001507 assert all (x in flds ["Liste1" ]["/_States_" ] for x in ["Liste1" , "Liste2" , "Liste3" ])
1508+ del reader , flds
1509+ import gc
1510+ gc .collect ()
15011511
15021512 Path (write_data_here ).unlink ()
15031513
0 commit comments