From 89a2c0da1bf1cfffc5dfc9b230653f78430c1c5d Mon Sep 17 00:00:00 2001 From: Mike Fiedler Date: Wed, 23 Feb 2022 12:59:18 +0000 Subject: [PATCH] chore: enable context reporting in coverage 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 --- .coveragerc | 1 + bin/tests | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.coveragerc b/.coveragerc index 5814f2821007..c170c80db7e3 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,5 +1,6 @@ [run] branch = True +dynamic_context = test_function source = warehouse diff --git a/bin/tests b/bin/tests index c6449742c4a5..fffca548bb61 100755 --- a/bin/tests +++ b/bin/tests @@ -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