Coverage.py vs Microsoft Code Coverage
Coverage.py
coverage.readthedocs.ioMicrosoft Code Coverage
github.comSide by side
| Figure | Coverage.py | Microsoft Code Coverage |
|---|---|---|
| Price from | Free | Free |
| Free plan | Yes | Yes |
| Free trial | — | — |
| Open source | Yes | — |
| Windows | Yes | Yes |
| macOS | Yes | Yes |
| Linux | Yes | Yes |
| API | Yes | — |
| Self-hosted | Yes | — |
| Plans published | 2 | 1 |
| Spec score · Test Coverage Tools | 8.9 (#2) | 7.5 (#18) |
| Configuration | Settings can live in .coveragerc, TOML, setup.cfg, tox.ini, or pyproject.toml files. | Coverage settings can control output, inclusion and exclusion rules, and instrumentation options using runsettings or dedicated coverage settings files. |
| Intended users | The documentation presents Coverage.py as a tool for people measuring Python test effectiveness by seeing which code tests exercise and which they miss. | The documented workflows cover .NET test projects and other .NET applications that users want to measure for code coverage. |
| Purpose | Coverage.py measures which parts of Python programs ran and identifies executable code that did not run, commonly to gauge test effectiveness. | Measures what proportion of a project's code is exercised by coded tests such as unit tests. |
| Report formats | Reports can be emitted as text, HTML, XML, LCOV, or JSON. | The MTP coverage extension supports coverage, XML, and Cobertura output formats. |
| Security | The project directs vulnerability reports to Tidelift, which it says will coordinate the fix and disclosure. | The repository links to a security policy, but its README describes this repository as documentation and samples for closed-source coverage functionality. |
| Support | Users can seek help on the Python discussion forums or Python Discord, report bugs on GitHub, and obtain professional support through Tidelift Subscription. | The repository invites users to report issues related to the Microsoft.CodeCoverage and dotnet-coverage NuGet packages and Visual Studio code coverage functionality. |
Plans
In their own words
Coverage.py
Coverage.py measures which parts of Python programs run and highlights executable code that remains untouched, helping developers assess what their tests exercise. It measures statement coverage by default and can also track branch coverage. Reports are available as text, HTML, XML, LCOV, and JSON. Dynamic contexts can associate lines of execution with the test function that ran them. Coverage.py can run test suites through their usual command; pytest-cov is available but the documentation says most users do not need it. Third-party plugins can extend measurement to non-Python files, such as connecting executed Python to Django templates. Data is stored in a SQLite database, and advanced use can rely on its API. The current documentation lists Python 3.10 through 3.15 rc2 and PyPy3 versions 3.10 and 3.11. The tool provides ctrace, pytrace, and sysmon measurement cores; sysmon is faster for simple line and branch coverage but lacks support for dynamic contexts and plugins. Coverage.py is licensed under Apache 2.0 and runs on Linux, macOS, and Windows, with self-hosting available. It is free.
Microsoft Code Coverage
Microsoft Code Coverage measures how much of a project’s code is exercised by coded tests, such as unit tests. Its documented workflows cover.NET test projects with `dotnet test` and other.NET applications with the `dotnet-coverage` tool. It analyzes managed CLR and unmanaged native code using static or dynamic instrumentation; native coverage is disabled by default in the MTP extension. With Microsoft.Testing.Platform.MSBuild, extensions are auto-registered with MSTest, NUnit, and xUnit runners. The MTP extension can produce coverage, XML, and Cobertura reports, with settings for output, inclusion and exclusion rules, and instrumentation. It runs on Windows, macOS, and multiple Linux distributions, though instrumentation support varies by OS, version, and architecture. Other operating systems are supported on a best-effort basis, and some combinations allow static instrumentation only. Dynamic instrumentation on macOS and Linux requires libxml2, and missing dependencies may leave a report empty. MTP also excludes test assemblies by default unless configured otherwise. The plan is free.