Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Commit

Permalink
appveyor tests API summary
Browse files Browse the repository at this point in the history
  • Loading branch information
spirit1317 committed Dec 3, 2020
1 parent 64eba09 commit cb9b202
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
5 changes: 3 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,9 @@ test_script:
- cmd: path=%PYTHON_ROOT%\Scripts;%path%
- cmd: nul > summary.json
- cmd: run_tests_win.bat
- cmd: type summary.json

- cmd: set API_URL=%APPVEYOR_API_URL%/api/tests/batch
- cmd: powershell -command "$body = Get-Content summary.json -Raw; Invoke-Webrequest $env:API_URL -Method 'POST' -UseBasicParsing -ContentType 'application/json; charset=utf-8' -Body $body"

after_test:
- cmd: cd C:/projects/pytango/dist
- cmd: dir
Expand Down
16 changes: 10 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@ def pytest_runtest_makereport():
try:
summary = json.loads(summary)
except:
summary = {}
summary = []
finally:
outcome = str(result.outcome)
if outcome in summary:
summary[outcome] += 1
else:
summary[outcome] = 1
outcome = str(result.outcome).capitalize()
test = {
"testName": result.nodeid,
"outcome": outcome,
"durationMilliseconds": result.duration,
"StdOut": result.capstdout,
"StdErr": result.capstderr,
}
summary.append(test)
f.seek(0)
f.write(json.dumps(summary))
f.truncate()

0 comments on commit cb9b202

Please sign in to comment.