From 197fb91574310ce800419c8b7112ff4cc0cee27f Mon Sep 17 00:00:00 2001 From: nulano Date: Sat, 12 Oct 2019 11:59:03 +0100 Subject: [PATCH] upload image errors to GitHub Actions --- .github/workflows/test-windows.yml | 7 +++++++ .github/workflows/test.yml | 7 +++++++ Tests/helper.py | 18 ++++++++++++++++-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 50aff6bfe11..075707bf6bd 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -349,6 +349,13 @@ jobs: %PYTHON%\python.exe -m pytest -vx --cov PIL --cov-report term --cov-report xml Tests shell: cmd + - name: Upload errors + uses: actions/upload-artifact@v1 + if: failure() + with: + name: errors + path: Tests/errors + - name: Upload coverage run: 'codecov --file "%GITHUB_WORKSPACE%\coverage.xml" --name "%pythonLocation%"' shell: cmd diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cab5b642ace..163250248d4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,6 +53,13 @@ jobs: run: | .travis/test.sh + - name: Upload errors + uses: actions/upload-artifact@v1 + if: failure() + with: + name: errors + path: Tests/errors + - name: Docs if: matrix.python-version == 3.8 run: | diff --git a/Tests/helper.py b/Tests/helper.py index 93f6c6ddab0..57bbab0c93d 100644 --- a/Tests/helper.py +++ b/Tests/helper.py @@ -24,12 +24,26 @@ HAS_UPLOADER = True class test_image_results: - @classmethod - def upload(self, a, b): + @staticmethod + def upload(a, b): a.show() b.show() +elif "GITHUB_ACTIONS" in os.environ: + HAS_UPLOADER = True + + class test_image_results: + @staticmethod + def upload(a, b): + dir_errors = os.path.join(os.path.dirname(__file__), "errors") + os.makedirs(dir_errors, exist_ok=True) + tmpdir = tempfile.mkdtemp(dir=dir_errors) + a.save(os.path.join(tmpdir, "a.png")) + b.save(os.path.join(tmpdir, "b.png")) + return tmpdir + + else: try: import test_image_results