Coverage Configuration

Index of All Documentation » Wing Pro Reference Manual » Unit Testing » Code Coverage »


There are several options that control code coverage behavior on the Testing tab of Project Properties, accessed from the Project menu:

  • Use Code Coverage enables or disables the collection of code coverage data and display of code coverage markup in Wing's editor. This is also available as a menu item in the Testing menu.
  • Measure Coverage Only in Project Files restricts the measurement of code coverage statistics to only files that are in directories that have been added to the Project tool.
  • Extra Coverage Args allows passing additional arguments to the coverage run command that Wing invokes when running unit tests with code coverage enabled.
  • Clear Data on Project Close selects whether Wing will clear all code coverage data when the project is closed. The options are to never clear, always clear, or prompt whether to clear. By default, code coverage statistics and support data are retained even when Wing exits. This allows Wing to track data and determine which tests were invalidated even for changes made while Wing is not running, such as update of many files as a result of pulling revisions from a repository. Note, however, that the data stored by Wing may become quite large. See Coverage Data Files for details.
  • Combine Data from Multiple Python Environments causes Wing to merge all the code coverage data collected from unit tests, even if some of those tests are using different Python environments. See Multiple Python Environments in Code Coverage Environments for details.

Selectively Disabling Coverage

The environment variable WING_COVERAGE_DISABLE can be set in a launch configuration to disable collecting code coverage for specific unit test files. This is useful when some testing files are run with versions of Python that are no longer supported by coverage or that use a Python environment that does not have coverage installed into it.

Do do this, right-click on the unit test file and select Properties and then under the Testing tab set Environment to Use Selected Launch Configuration. Then either create or use an existing launch configuration and set WING_COVERAGE_DISABLE=1 under the Environment tab of the launch configuration.