Skip to content

Commit

Permalink
Compute coverage of all files
Browse files Browse the repository at this point in the history
Include all files from the `lobster` folder when computing the coverage.

This implies three changes:
- set `--source=lobster` when running unit tests
- set `--source=<relative path to "lobster">` when running system tests
- remove the `omit` section from the coverage computation file
- reduce the `--fail-under` parameter
  • Loading branch information
phiwuu committed Feb 10, 2025
1 parent 6ac041a commit dc38cd4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ unit-tests:
coverage run -p \
--branch --rcfile=coverage.cfg \
--data-file .coverage \
--source=lobster \
-m unittest discover -s tests-unit -v

upload-main: packages
Expand All @@ -102,7 +103,7 @@ full-release:
coverage:
coverage combine -q
coverage html --rcfile=coverage.cfg
coverage report --rcfile=coverage.cfg --fail-under=58
coverage report --rcfile=coverage.cfg --fail-under=53

test: clean-coverage system-tests unit-tests
make coverage
Expand Down
6 changes: 0 additions & 6 deletions coverage.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,3 @@ exclude_lines =
def __repr__(self)
def sanity_test()
if __name__ == "__main__"

[run]
omit =
/usr/*
*/site-packages/*
tests-unit/*
8 changes: 3 additions & 5 deletions tests-system/run_tool_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,12 @@ def _run_test(setup: TestSetup, tool: str) -> CompletedProcess:
print(f"Starting system test '{setup.name}' with arguments {setup.args} " \
f"for tool '{tool}' with coverage.")
root_directory = Path(__file__).resolve().parents[1]
coverage_config_path = root_directory / "coverage.cfg"
coverage_data_path = root_directory / ".coverage"

coverage_command = [
"coverage", "run", "-p",
f"--rcfile={coverage_config_path}",
f"--rcfile={root_directory / 'coverage.cfg'}",
"--branch",
f"--data-file={coverage_data_path}",
f"--data-file={root_directory / '.coverage'}",
f"--source={root_directory / 'lobster'}",
tool, *setup.args
]

Expand Down

0 comments on commit dc38cd4

Please sign in to comment.