Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST: Fix side effect #2379 #2395

Merged
merged 2 commits into from
Jan 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions tests/test_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ def writer_operate(writer: PdfWriter) -> None:
)
def test_writer_operations_by_traditional_usage(convert, needs_cleanup):
if callable(convert):
write_data_here = convert(NamedTemporaryFile(suffix=".pdf", delete=False).name)
with NamedTemporaryFile(suffix=".pdf", delete=False) as fo:
write_data_here = convert(fo.name)
else:
write_data_here = convert

Expand Down Expand Up @@ -254,7 +255,8 @@ def test_writer_operations_by_traditional_usage(convert, needs_cleanup):
)
def test_writer_operations_by_semi_traditional_usage(convert, needs_cleanup):
if callable(convert):
write_data_here = convert(NamedTemporaryFile(suffix=".pdf", delete=False).name)
with NamedTemporaryFile(suffix=".pdf", delete=False) as fo:
write_data_here = convert(fo.name)
else:
write_data_here = convert

Expand All @@ -281,11 +283,10 @@ def test_writer_operations_by_semi_traditional_usage(convert, needs_cleanup):
(BytesIO(), False),
],
)
def test_writer_operations_by_semi_new_traditional_usage(
convert, needs_cleanup
):
def test_writer_operations_by_semi_new_traditional_usage(convert, needs_cleanup):
if callable(convert):
write_data_here = convert(NamedTemporaryFile(suffix=".pdf", delete=False).name)
with NamedTemporaryFile(suffix=".pdf", delete=False) as fo:
write_data_here = convert(fo.name)
else:
write_data_here = convert

Expand All @@ -309,7 +310,8 @@ def test_writer_operations_by_semi_new_traditional_usage(
)
def test_writer_operation_by_new_usage(convert, needs_cleanup):
if callable(convert):
write_data_here = convert(NamedTemporaryFile(suffix=".pdf", delete=False).name)
with NamedTemporaryFile(suffix=".pdf", delete=False) as fo:
write_data_here = convert(fo.name)
else:
write_data_here = convert

Expand Down
Loading