python-pillow / Pillow

Python Imaging Library (Fork)
https://python-pillow.org
Other
12.32k stars 2.23k forks source link

Use fixture to re-open image for each JPEG2000 test #8484

Closed radarhere closed 3 weeks ago

radarhere commented 1 month ago

At the start of test_file_jpeg2k.py, an image is opened. https://github.com/python-pillow/Pillow/blob/d59b169ed257ca14d86c90dbf3384b8b3999fc5c/Tests/test_file_jpeg2k.py#L32-L33

It is then used throughout the tests. https://github.com/python-pillow/Pillow/blob/d59b169ed257ca14d86c90dbf3384b8b3999fc5c/Tests/test_file_jpeg2k.py#L103-L110

Rather than re-using the same image instance throughout the tests, and allowing it to be potentially modified in one test and affect all subsequent tests, this PR uses a fixture to re-open it each time, following the style of test_image_resize.py.