From c10446f17d4d38a69c9f7e0277486515ed2a9efa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ondrej=20Baranovi=C4=8D?= Date: Mon, 27 Nov 2023 22:32:00 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Hugo van Kemenade --- .github/workflows/wheels.yml | 7 +++---- Tests/helper.py | 4 ++-- Tests/test_imagegrab.py | 6 ++++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index de43b1206ba..f8f2c2794b5 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -96,7 +96,7 @@ jobs: path: Tests\test-images - uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.x" - name: Prepare for build run: | choco install nasm --no-progress @@ -137,14 +137,13 @@ jobs: CIBW_BEFORE_ALL: "{package}\\winbuild\\build\\build_dep_all.cmd" CIBW_CACHE_PATH: "C:\\cibw" CIBW_TEST_SKIP: "*-win_arm64" - CIBW_TEST_COMMAND: >- - docker run --rm + CIBW_TEST_COMMAND: 'docker run --rm -v {project}:C:\pillow -v C:\cibw:C:\cibw -v %CD%\..\venv-test:%CD%\..\venv-test -e CI -e GITHUB_ACTIONS mcr.microsoft.com/windows/servercore:ltsc2022 - powershell C:\pillow\.github\workflows\wheels-test.ps1 %CD%\..\venv-test + powershell C:\pillow\.github\workflows\wheels-test.ps1 %CD%\..\venv-test' shell: cmd - name: Upload wheels uses: actions/upload-artifact@v3 diff --git a/Tests/helper.py b/Tests/helper.py index b985a571d98..cce7eca3a5a 100644 --- a/Tests/helper.py +++ b/Tests/helper.py @@ -263,7 +263,7 @@ def djpeg_available(): try: subprocess.check_call(["djpeg", "-version"]) return True - except subprocess.CalledProcessError: + except subprocess.CalledProcessError: # pragma: no cover return False @@ -272,7 +272,7 @@ def cjpeg_available(): try: subprocess.check_call(["cjpeg", "-version"]) return True - except subprocess.CalledProcessError: + except subprocess.CalledProcessError: # pragma: no cover return False diff --git a/Tests/test_imagegrab.py b/Tests/test_imagegrab.py index d230b9d81a6..a75cbadc4ad 100644 --- a/Tests/test_imagegrab.py +++ b/Tests/test_imagegrab.py @@ -11,12 +11,14 @@ class TestImageGrab: + @pytest.mark.skipif( + os.environ.get("USERNAME") == "ContainerAdministrator", + reason="can't grab screen when running in Docker", + ) @pytest.mark.skipif( sys.platform not in ("win32", "darwin"), reason="requires Windows or macOS" ) def test_grab(self): - if os.environ.get("USERNAME") == "ContainerAdministrator": - pytest.skip("can't grab screen when running in Docker") ImageGrab.grab() ImageGrab.grab(include_layered_windows=True) ImageGrab.grab(all_screens=True)