-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed failure of exit-behavior tests during coverage reporting.
Just like in the recently revamped test runner (`test.py`), the project root folder must be added to the Python search path. While pyTest does add the root folder to `sys.path` in its own process, it is not available in the subprocesses testing the exit behavior. Which is why these tests failed when `tools/coverage.py` was run.
- Loading branch information
Showing
2 changed files
with
51 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,24 @@ | ||
"""Uploads the coverage report to CodeCov.""" | ||
""" | ||
Uploads the coverage report to CodeCov. | ||
The script expects the CodeCov uploader to be installed locally. On | ||
Windows, for example, `codecov.exe` would have to be on the search path. | ||
It also expects the CodeCov upload token for this project to be set as | ||
an environment variable. | ||
CodeCov does not accept Coverage.py's standard report format, i.e. the | ||
`.coverage` file. It must be converted to XML format before upload. | ||
""" | ||
|
||
from subprocess import run | ||
from pathlib import Path | ||
from os import environ | ||
|
||
|
||
token = environ.get('MPh_CodeCov_token', None) | ||
if not token: | ||
raise RuntimeError('CodeCov upload token not set in environment.') | ||
|
||
root = Path(__file__).resolve().parent.parent | ||
run(['coverage', 'xml'], cwd=root) | ||
run(['codecov', '--file', 'coverage.xml', '--token', token], cwd=root) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters