Running with Coverage
PyCharm provides a dedicated action that allows you to perform run with code coverage measurement. The code coverage data are processed according to the option selected in the Coverage page of the Settings/Preferences dialog box.
To run with code coverage measurement
- Do one of the following:
Open the desired file in the editor, and chooseon the context menu. When running tests with coverage, note that you can run the entire test class, or each individual test method, depending on the caret location.
Select the desired run/debug configuration, and then on the main menu choose.
On the main toolbar, click . This will launch the selected run/debug configuration.
- If the Show options before applying coverage to the editor checkbox has been selected in the Coverage page of the Settings/Preferences dialog box, choose whether you want to replace the active coverage suites, or add the collected data to the active suites, or do not want not apply coverage data. You can also opt to skip this dialog in the future.
In case any other option has been selected, the respective action will be performed silently.