Use fixture to re-open image for each JPEG2000 test by radarhere · Pull Request #8484 · python-pillow/Pillow
At the start of test_file_jpeg2k.py, an image is opened.
| test_card = Image.open("Tests/images/test-card.png") | |
| test_card.load() |
It is then used throughout the tests.
| def test_lossless_rt() -> None: | |
| im = roundtrip(test_card) | |
| assert_image_equal(im, test_card) | |
| def test_lossy_rt() -> None: | |
| im = roundtrip(test_card, quality_layers=[20]) | |
| assert_image_similar(im, test_card, 2.0) |
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.