From 9c6b30560e6ac3b17e9053d1a4e2c1af3508e339 Mon Sep 17 00:00:00 2001 From: Yay295 Date: Wed, 27 Mar 2024 10:51:33 -0500 Subject: [PATCH 1/3] use setup_module() to open images so they aren't opened if skipped --- Tests/test_image_fromqimage.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Tests/test_image_fromqimage.py b/Tests/test_image_fromqimage.py index c20123a1bbf..e214e58f942 100644 --- a/Tests/test_image_fromqimage.py +++ b/Tests/test_image_fromqimage.py @@ -16,13 +16,14 @@ not ImageQt.qt_is_installed, reason="Qt bindings are not installed" ) -ims = [ - hopper(), - Image.open("Tests/images/transparent.png"), - Image.open("Tests/images/7x13.png"), -] +ims = [] +def setup_module() -> None: + ims.append(hopper()) + ims.append(Image.open("Tests/images/transparent.png")) + ims.append(Image.open("Tests/images/7x13.png")) + def teardown_module() -> None: for im in ims: im.close() From 26a212126f03eef8d8750911c452362df9fe1965 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:57:33 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- Tests/test_image_fromqimage.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/test_image_fromqimage.py b/Tests/test_image_fromqimage.py index e214e58f942..7bd94cde751 100644 --- a/Tests/test_image_fromqimage.py +++ b/Tests/test_image_fromqimage.py @@ -24,6 +24,7 @@ def setup_module() -> None: ims.append(Image.open("Tests/images/transparent.png")) ims.append(Image.open("Tests/images/7x13.png")) + def teardown_module() -> None: for im in ims: im.close() From 0d86da54bcec702cf38db2c7031a218598aa5858 Mon Sep 17 00:00:00 2001 From: Yay295 Date: Wed, 27 Mar 2024 14:02:02 -0500 Subject: [PATCH 3/3] add typing to "ims" in test_image_fromqimage.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ondrej Baranovič --- Tests/test_image_fromqimage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/test_image_fromqimage.py b/Tests/test_image_fromqimage.py index 7bd94cde751..1149e29649e 100644 --- a/Tests/test_image_fromqimage.py +++ b/Tests/test_image_fromqimage.py @@ -16,7 +16,7 @@ not ImageQt.qt_is_installed, reason="Qt bindings are not installed" ) -ims = [] +ims: list[Image.Image] = [] def setup_module() -> None: