File tree Expand file tree Collapse file tree 2 files changed +3
-0
lines changed Expand file tree Collapse file tree 2 files changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -314,6 +314,7 @@ def __init__(
314314
315315 if isinstance (stream , (str , Path )):
316316 stream = open (stream , "rb" ) # noqa: SIM115
317+ # Wish I could just close stream in __del__ but that fails a test very strangely
317318 weakref .finalize (self , stream .close )
318319
319320 self .read (stream )
Original file line number Diff line number Diff line change @@ -1234,6 +1234,7 @@ def test_set_page_label(pdf_file_path):
12341234 writer .set_page_label (0 , 1 , "/A" )
12351235 writer .write (pdf_file_path )
12361236 assert PdfReader (pdf_file_path ).page_labels [: len (expected )] == expected
1237+ del writer
12371238
12381239 pdf_file_path .unlink ()
12391240
@@ -1477,6 +1478,7 @@ def test_update_form_fields(tmp_path):
14771478 )
14781479
14791480 writer .write (write_data_here )
1481+ del writer
14801482 reader = PdfReader (write_data_here )
14811483 flds = reader .get_fields ()
14821484 assert flds ["CheckBox1" ]["/V" ] == "/Yes"
You can’t perform that action at this time.
0 commit comments