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

Commit

Permalink
windows tests summary
Browse files Browse the repository at this point in the history
  • Loading branch information
spirit1317 committed Dec 3, 2020
1 parent 25012e9 commit 64eba09
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ test_script:
- "%PYTHON_ROOT%/Scripts/pytest.exe -c pytest_empty_config.txt --collect-only -q -q tests"
- cmd: cd "C:\projects\pytango\tests"
- cmd: path=%PYTHON_ROOT%\Scripts;%path%
- cmd: nul > summary.json
- cmd: run_tests_win.bat
- cmd: type summary.json

after_test:
- cmd: cd C:/projects/pytango/dist
Expand Down
24 changes: 24 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,27 @@ def pytest_sessionfinish(session):
f.write("\n")
f.write("pytest -c ../pytest_empty_config.txt ")#this empty file is created by appveyor
f.write(item.nodeid)

@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport():
""" produces summary.json file for quick windows test summary """
summary_path = "summary.json"

outcome = yield # Run all other pytest_runtest_makereport non wrapped hooks
result = outcome.get_result()
if result.when == "call" and 'nt' in os.name and os.path.isfile(summary_path):
with open(summary_path, "r+") as f:
summary = f.read()
try:
summary = json.loads(summary)
except:
summary = {}
finally:
outcome = str(result.outcome)
if outcome in summary:
summary[outcome] += 1
else:
summary[outcome] = 1
f.seek(0)
f.write(json.dumps(summary))
f.truncate()

0 comments on commit 64eba09

Please sign in to comment.