Skip to content

Commit

Permalink
chore: enable context reporting in coverage
Browse files Browse the repository at this point in the history
coverage.py version 5.0 introduced the notion of measurement contexts.
This adds details to the report to show:

- how many times a given line was executed
- which context executed a given line

Enabling dynamic context measurement during the test execution adds
test class/function contexts to the coverage data to be displayed on
a given report output.

Refs: https://coverage.readthedocs.io/en/6.3.2/contexts.html#dynamic-contexts

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
  • Loading branch information
miketheman committed Feb 23, 2022
1 parent 2145cf9 commit 89a2c0d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[run]
branch = True
dynamic_context = test_function

source =
warehouse
Expand Down
2 changes: 1 addition & 1 deletion bin/tests
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ set -x

# Actually run our tests.
python -m coverage run -m pytest --strict-markers $COMMAND_ARGS
python -m coverage html
python -m coverage html --show-contexts
python -m coverage report -m --fail-under 100

0 comments on commit 89a2c0d

Please sign in to comment.