{"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.","language":"python","status":"abandoned","last_verified":"Wed Apr 15","install":{"commands":["pip install pytest-cover","pip install pytest-cov"],"cli":null},"imports":[],"auth":{"required":false,"env_vars":[]},"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`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}