PyCharm 2021.1 Help

Coverage

Code coverage in PyCharm allows you to perform on-the-fly line coverage measuring for your code with low runtime overhead. In general, line coverage answers the question, "Was this line of code executed during unit testing simulation?"

Use this page to configure how coverage data is collected and processed.

When new coverage is gathered

These options control how collected coverage data is processed.

Show options before applying coverage to the editorShow the Code Coverage dialog every time you launch a new run configuration with code coverage. The coverage options dialog is displayed when different coverage data has been produced.
Do not apply collected coverageDiscard new code coverage results.
Replace active suites with the new oneDiscard active suites and use the new one every time you launch a new run configuration with code coverage.
Add to active suitesAppend new code coverage suite to the active suites every time you launch a new run configuration with code coverage.
Activate Coverage ViewShow the Coverage tool window when an application or test is run with coverage.

Python coverage

These options are available only if the Python plugin is enabled.

ItemDescription
Use bundled coverage.pyUse the bundled coverage.py script. If disabled, PyCharm will use the coverage tool included in the selected Python interpreter.
Branch coverage

Enable branch coverage in the coverage.py script.

Thus additional information to the pure line coverage reports is added, marking the coverage of lines with conditional statements as incomplete in case one or more branches haven’t been executed.

coverage branch

For more information, see this page.

Last modified: 18 May 2021