Recall & Review
beginner
What is a coverage report in pytest?
A coverage report shows which parts of your code were tested and which were not during test execution.
Click to reveal answer
beginner
Name three common coverage report formats supported by pytest-cov.
Terminal (text output), HTML (interactive web pages), and XML (machine-readable format).
Click to reveal answer
beginner
How do you generate an HTML coverage report using pytest?
Run pytest with the option: --cov-report=html. This creates a folder named 'htmlcov' with the report files.
Click to reveal answer
intermediate
What is the benefit of an XML coverage report?
XML reports can be used by other tools like CI servers to analyze coverage automatically.
Click to reveal answer
beginner
What does the terminal coverage report show?
It shows a summary of coverage percentages and which lines were missed directly in the command line.
Click to reveal answer
Which pytest-cov option generates an HTML coverage report?
✗ Incorrect
The correct option to generate an HTML report is --cov-report=html.
What folder is created by default when generating an HTML coverage report?
✗ Incorrect
The folder named 'htmlcov' is created by pytest-cov for HTML reports.
Which coverage report format is best for automated tools and CI servers?
✗ Incorrect
XML format is machine-readable and commonly used by CI tools.
What does the terminal coverage report NOT provide?
✗ Incorrect
Terminal reports are text-based and do not have interactive links.
Which command shows coverage summary directly in the terminal?
✗ Incorrect
The 'term-missing' option shows coverage summary with missing lines in the terminal.
Explain the differences between terminal, HTML, and XML coverage reports in pytest.
Think about who uses each format and how.
You got /3 concepts.
Describe how to generate and view an HTML coverage report using pytest.
Remember the folder name and how to open the report.
You got /3 concepts.