File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 22Contexts
33========
44
5- Coverage.py 5.0 can record separate coverage data for different contexts during
5+ Coverage.py 5.0 can record separate coverage data for ` different contexts `_ during
66one run of a test suite. Pytest-cov can use this feature to record coverage
77data for each test individually, with the ``--cov-context=test `` option.
88
9+ .. _`different_contexts` : https://coverage.readthedocs.io/en/stable/contexts.html
10+
911The context name recorded in the coverage.py database is the pytest test id,
1012and the phase of execution, one of "setup", "run", or "teardown". These two
1113are separated with a pipe symbol. You might see contexts like::
@@ -16,3 +18,12 @@ are separated with a pipe symbol. You might see contexts like::
1618
1719Note that parameterized tests include the values of the parameters in the test
1820id, and each set of parameter values is recorded as a separate test.
21+
22+ To view contexts when using ``--cov-report=html ``, add this to your ``.coveragerc ``::
23+
24+ [html]
25+ show_contexts = True
26+
27+ The HTML report will include an annotation on each covered line, indicating the
28+ number of contexts that executed the line. Clicking the annotation displays a
29+ list of the contexts.
You can’t perform that action at this time.
0 commit comments