Skip to content

Commit c7b4302

Browse files
committed
Neaten image_file fixture - dedent the main work
1 parent 157f60c commit c7b4302

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tests/conftest.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,10 @@ def image_file(
5454
) -> Generator[io.BufferedRandom, None, None]:
5555
"""An image file object."""
5656
file = tmp_path / "image.jpg"
57-
file.touch()
58-
with file.open("r+b") as fileobj:
59-
buffer = high_quality_image.getvalue()
60-
fileobj.write(buffer)
61-
yield fileobj
57+
buffer = high_quality_image.getvalue()
58+
file.write_bytes(data=buffer)
59+
with file.open("r+b") as file_obj:
60+
yield file_obj
6261

6362

6463
@pytest.fixture(params=["high_quality_image", "image_file"])

0 commit comments

Comments
 (0)