{"id":6437,"library":"pytest-cover","title":"pytest-cover","description":"pytest-cover is a pytest plugin for measuring code coverage, which was forked from pytest-cov. The project was officially merged back into pytest-cov in January 2019, and its GitHub repository explicitly states to use pytest-cov instead. This library (version 3.0.0) is effectively abandoned and users are strongly advised to use the actively maintained `pytest-cov` for coverage reporting with pytest.","status":"abandoned","version":"3.0.0","language":"en","source_language":"en","source_url":"https://github.com/ionelmc/pytest-cover","tags":["pytest","coverage","testing","plugin"],"install":[{"cmd":"pip install pytest-cover","lang":"bash","label":"Install pytest-cover (not recommended)"},{"cmd":"pip install pytest-cov","lang":"bash","label":"Recommended: Install pytest-cov"}],"dependencies":[{"reason":"Core testing framework.","package":"pytest"},{"reason":"Underlying code coverage engine.","package":"coverage"},{"reason":"For distributed testing support (optional, as per original project README).","package":"pytest-xdist","optional":true}],"imports":[],"quickstart":{"code":"# This quickstart is for the recommended alternative: pytest-cov\n# Install required packages: pip install pytest pytest-cov\n\n# my_module.py\ndef my_function(x):\n    if x > 0:\n        return x * 2\n    else:\n        return 0\n\n# test_my_module.py\nfrom my_module import my_function\n\ndef test_positive_input():\n    assert my_function(5) == 10\n\ndef test_zero_input():\n    assert my_function(0) == 0\n\ndef test_negative_input():\n    assert my_function(-3) == 0\n\n# To run tests and generate a coverage report (terminal output):\n# pytest --cov=my_module\n\n# To generate an HTML report:\n# pytest --cov=my_module --cov-report=html\n\n# Example of running the command (execute in your terminal where files are saved):\n# import os\n# os.system('pytest --cov=my_module')\n# os.system('pytest --cov=my_module --cov-report=html')\n","lang":"python","description":"Since `pytest-cover` is abandoned, the quickstart illustrates usage for its successor, `pytest-cov`. It involves creating a simple Python module and a corresponding test file. The plugin integrates directly with `pytest` via command-line options. Running `pytest --cov=your_module` will execute tests and show a coverage report in the terminal. You can also generate an HTML report with `--cov-report=html`."},"warnings":[{"fix":"Migrate to `pytest-cov`. Uninstall `pytest-cover` (`pip uninstall pytest-cover`) and install `pytest-cov` (`pip install pytest-cov`). Review `pytest-cov`'s documentation for any specific migration steps or differences in configuration.","message":"The `pytest-cover` project is officially abandoned and has been merged back into `pytest-cov` since January 2019. Further development, bug fixes, or compatibility updates for `pytest-cover` are not expected. Using this library in new projects or maintaining it in existing ones is strongly discouraged.","severity":"breaking","affected_versions":"3.0.0 and older"},{"fix":"If encountering unexpected coverage behavior related to subprocesses, ensure all remnants of `pytest-cover` (and older `pytest-cov` versions) are uninstalled. `pytest-cov` version 7+ replaced the `.pth` file approach with `coverage`'s patch options (e.g., `[run] concurrency = multiprocessing` and `patch = subprocess` in `.coveragerc`).","message":"Older versions of `pytest-cover` (and `pytest-cov` before version 7) relied on `.pth` files for subprocess coverage measurement, which could lead to issues, especially with `easy_install` or specific uninstallation scenarios leaving stray files.","severity":"gotcha","affected_versions":"All versions of pytest-cover"},{"fix":"Use `pytest-cov` instead, which is actively maintained and supports modern Python versions (currently Python 3.9+ for `pytest-cov` 6.0.0+, and has dropped support for Python 3.8 in `pytest-cov` 6.0.0). Refer to `pytest-cov`'s changelog for specific Python and `pytest` version compatibility.","message":"Given its abandonment in 2019, `pytest-cover` (version 3.0.0) is unlikely to be compatible with recent Python versions (e.g., Python 3.9+) or the latest versions of `pytest` itself, which frequently introduce breaking changes or drop support for older Python versions. For example, `pytest` 8 dropped support for Python 3.7.","severity":"breaking","affected_versions":"All versions of pytest-cover when used with Python 3.8+ or pytest 7+"},{"fix":"When using distributed testing with `pytest-xdist`, ensure `pytest-cov` (the recommended alternative) and `coverage` are installed in all worker environments. Configure `coverage` for parallel execution (e.g., `[run] parallel = true` in `.coveragerc`) to correctly combine results.","message":"The old `pytest-cover` README warned that for distributed testing, workers (slaves) must have `pytest-cover` installed, and environment variables for subprocess measurement must propagate. Similar considerations apply to `pytest-cov` with `pytest-xdist`.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z"}