What is the main purpose of using pytest-cov in a Python testing environment?
Think about what 'cov' in pytest-cov might stand for.
pytest-cov is a plugin that measures code coverage, showing which parts of the code were run during tests.
What output will you see after running this command?
pytest --cov=my_module tests/
Assume my_module has 100 lines, and tests cover 80 lines.
Think about what coverage means and what the command requests.
The command runs tests and shows coverage for my_module. Since only 80 lines are covered, the report shows 80% coverage.
Which pytest.ini configuration correctly enables coverage reporting for the app package and generates an XML report?
Check the exact option names for pytest-cov.
The correct options are --cov=app and --cov-report=xml. Other options are invalid or incorrectly formatted.
Which assertion correctly checks that the coverage percentage is at least 90% in a pytest-cov generated report stored as a variable coverage_percent?
Think about including 90% as acceptable coverage.
Using >= 90 ensures coverage is at least 90%, including exactly 90%. Other options exclude 90% or check wrong conditions.
You ran pytest --cov=myapp tests/ but no coverage report is generated. Which is the most likely cause?
Think about what enables coverage reporting in pytest.
If pytest-cov is not installed, pytest does not recognize --cov and no coverage report is generated. Other options do not prevent coverage report generation if tests run.