-
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.
Added reporting of test code coverage.
Code coverage by the test suite is measured via pyTest and its pytest-cov plug-in. As pyTest cannot run the entire test suite in one go (as the Java VM is started multiple times, by separate test scripts), the script `coverage.py` is provided in the `deploy` folder to automate the runs of inidividual test scripts and combine the reports into a unified file. The script also creates the coverage badge, unless that file already exists. In other words, delete the badge to update the coverage percentage. Test coverage is reported for Windows only. Code that targets other platforms is therefore exluded from the reporting.
- Loading branch information
Showing
9 changed files
with
76 additions
and
21 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,14 @@ | ||
/develop/ | ||
/deploy/docs/ | ||
/deploy/dist/ | ||
/deploy/coverage/ | ||
/deploy/coverage.sqlite | ||
/dist/ | ||
**/__pycache__ | ||
**/.pytest_cache | ||
flake8.txt | ||
.spyproject | ||
.idea | ||
*.lnk | ||
.DS_Store | ||
Thumbs.db | ||
.spyproject | ||
.idea |
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
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
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"""Measures code coverage by test suite.""" | ||
__license__ = 'MIT' | ||
|
||
from subprocess import run | ||
from pathlib import Path | ||
|
||
here = Path(__file__).resolve().parent | ||
root = here.parent | ||
|
||
file = here/'coverage.sqlite' | ||
if file.is_file(): | ||
print('Rendering coverage report.') | ||
folder = (here/'coverage').relative_to(root) | ||
run(['coverage', 'html', f'--directory={folder}'], cwd=root) | ||
badge = root/'tests'/file.with_suffix('.svg').name | ||
if badge.exists(): | ||
print('Coverage badge already exists.') | ||
else: | ||
print('Rendering coverage badge.') | ||
run(['coverage-badge', '-f', '-o', str(badge)], cwd=root) | ||
else: | ||
command = ['pytest', '--cov', '--cov-append'] | ||
tests = ['discovery', 'server', 'session', 'node', 'model', 'processes'] | ||
for test in tests: | ||
run(command + [f'tests/test_{test}.py'], 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
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
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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