From cd4656410f8d8ddcf806717e7404bc2f0392d88d Mon Sep 17 00:00:00 2001 From: Yay295 Date: Sun, 15 Jan 2023 17:32:58 -0600 Subject: [PATCH 1/2] parametrize test_file_tar::test_sanity() --- Tests/test_file_tar.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/Tests/test_file_tar.py b/Tests/test_file_tar.py index 5daab47fc..49451ff44 100644 --- a/Tests/test_file_tar.py +++ b/Tests/test_file_tar.py @@ -10,18 +10,21 @@ from .helper import is_pypy TEST_TAR_FILE = "Tests/images/hopper.tar" -def test_sanity(): - for codec, test_path, format in [ - ["zlib", "hopper.png", "PNG"], - ["jpg", "hopper.jpg", "JPEG"], - ]: - if features.check(codec): - with TarIO.TarIO(TEST_TAR_FILE, test_path) as tar: - with Image.open(tar) as im: - im.load() - assert im.mode == "RGB" - assert im.size == (128, 128) - assert im.format == format +@pytest.mark.parametrize( + ("codec", "test_path", "format"), + ( + ("zlib", "hopper.png", "PNG"), + ("jpg", "hopper.jpg", "JPEG"), + ), +) +def test_sanity(codec, test_path, format): + if features.check(codec): + with TarIO.TarIO(TEST_TAR_FILE, test_path) as tar: + with Image.open(tar) as im: + im.load() + assert im.mode == "RGB" + assert im.size == (128, 128) + assert im.format == format @pytest.mark.skipif(is_pypy(), reason="Requires CPython") From c2176f2747cd64cd2cf1d7ba859fde1a26f3db52 Mon Sep 17 00:00:00 2001 From: Yay295 Date: Sun, 15 Jan 2023 19:36:52 -0600 Subject: [PATCH 2/2] use string for parametrization name declaration Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com> --- Tests/test_file_tar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/test_file_tar.py b/Tests/test_file_tar.py index 49451ff44..799c243d6 100644 --- a/Tests/test_file_tar.py +++ b/Tests/test_file_tar.py @@ -11,7 +11,7 @@ TEST_TAR_FILE = "Tests/images/hopper.tar" @pytest.mark.parametrize( - ("codec", "test_path", "format"), + "codec, test_path, format", ( ("zlib", "hopper.png", "PNG"), ("jpg", "hopper.jpg", "JPEG"),