{"categories":[{"label":"Python Modules","url":"https://skillfed.io/packages/category/software-development-libraries-python-modules/17"}],"enrichment":{"capability":"A coverage.py plugin that applies conditional coverage rules based on environment markers, Python version, installed packages, or custom conditions, allowing code to be included or excluded from coverage measurement dynamically.","skillfed_tags":["coverage-measurement","testing-infrastructure","multi-environment"],"use_cases":["Mark Windows-only or Linux-only code blocks so they are only counted as covered when tests run on that platform.","Exclude code that only executes on Python 3.7 from coverage when testing on Python 3.10+, and vice versa.","Include or exclude optional-dependency code (e.g., Django integration) based on whether the package is installed in the test environment.","Achieve 100% coverage across multiple CI jobs that test different Python versions or OS combinations without false negatives.","Version-gate code paths so that code for a deprecated feature version is only measured when that version is present."],"what_it_does":"coverage-conditional-plugin extends coverage.py to mark code as covered or uncovered based on runtime conditions rather than static pragmas. Instead of using `# pragma: no cover` for code that only runs on certain Python versions, operating systems, or when specific packages are installed, you define named rules (e.g., `\"sys_version_info >= (3, 8)\": py-gte-38`) in your coverage configuration, then annotate code with `# pragma: py-gte-38`. The plugin evaluates the condition at test time and includes or excludes that code from coverage accordingly.\n\nIt supports environment markers from PEP 496 (Python version, OS, platform), custom functions like `is_installed()` to check for optional dependencies, and `package_version()` to version-gate code. You can also conditionally omit entire files based on conditions. This is useful for projects with platform-specific code, version-specific features, or optional dependencies\u2014you can achieve 100% coverage in multiple test environments without littering your code with unconditional pragmas.","worth_installing":"Yes, if you maintain a multi-environment test suite (different Python versions, OSes, or optional dependencies) and want accurate coverage reporting across all of them. The low install friction and permissive license make adoption straightforward. However, the dormant maintenance status (last release June 2023, no recent commits) means you should verify compatibility with your current coverage.py and Python versions before relying on it in production CI\u2014consider forking or monitoring the upstream repository if you need active support."},"id":"coverage-conditional-plugin","links":{"html":"https://skillfed.io/packages/coverage-conditional-plugin","md":"https://skillfed.io/packages/coverage-conditional-plugin.md","pypi":"https://pypi.org/project/coverage-conditional-plugin/"},"maintenance":{"status":"dormant"},"meta":{"latest_release":"2023-06-02","license_spdx":null,"license_treatment":"permissive","name":"coverage-conditional-plugin","python_support":"supports_current","summary":"Conditional coverage based on any rules you define!"},"popularity":{"monthly_downloads":169080,"position":10429,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"0.9.0"}
