Skip to content

Commit

Permalink
Upload image errors to GitHub Actions (#4135)
Browse files Browse the repository at this point in the history
Upload image errors to GitHub Actions
  • Loading branch information
hugovk committed Nov 17, 2019
2 parents 97327c7 + 197fb91 commit 4e4bb38
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
18 changes: 16 additions & 2 deletions Tests/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4e4bb38

Please sign in to comment.