Code Coverage Environments

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


Multiple Python Environments

Unit tests can be set up to run with different Python environments, by setting the Environment under the Testing tab of File Properties for individual unit test files.

When this is done, coverage must be installed into each of these environments. Tests that use an environment that is missing coverage will fail to run whenever Use Code Coverage is enabled in the Testing menu.

Since multiple environments may run different versions of coverage, there is a chance, in theory at least, that coverage statistics will fail to merge after tests are run. Because of this, Wing checks the version of coverage in all the environments and warns if they do not match. In most cases, mismatched versions will work just fine, but you should be aware that failure to display coverage statistics might result if multiple versions of coverage are used.

If you do run into problems with collecting code coverage statistics from multiple versions of coverage, you can disable the Combine Data from Multiple Python Environments on the Testing tab of Project Properties and view code coverage results with Show HTML Coverage Report or export code coverage data with Export Coverage Data, both in the Testing menu. These will prompt you to select the Python environments(s) to include in your report or exported data. However, viewing coverage data within Wing will not work if you are using incompatible versions of coverage, since that always tries to combine all the available data files, even if Combine Data from Multiple Python Environments is disabled.

Remote Hosts and Containers

Unit tests running on remote hosts and containers can also collect coverage statistics, just as for the local case.

If multiple hosts or containers are used for unit tests run from the same project, coverage data from those cannot be combined into a single report or export. In this case, the Combine Data from Multiple Python Environments option under the Testing tab in Project Properties should also be disabled.

Multi-Processing

If code being tested spawns child processes, no code coverage data will be collected or displayed for the child processes. This may be supported in the future for those process creatiopn cases currently covered by Wing's child process debugging capability; please contact support@wingware.com if you need this feature.