Some project have different parts that relies on different environments:
- #python version, some code is only executed on specific versions and ignored on others
- OS version, some code might be Windows, Mac, or Linux only
- External packages, some code is only executed when some 3rd party package is installed
Current best practice is to use
# pragma: no cover for this places in your project. coverage-conditional-plugin allows to use configurable pragmas that include code to the coverage if some condition evaluates to true, and fallback to ignoring this code when condition is false.Read the announcing post: https://sobolevn.me/2020/02/conditional-coverage
Go star this repo: https://github.com/wemake-services/coverage-conditional-plugin