0
0
PyTesttesting~10 mins

pytest-cov for coverage - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to run pytest with coverage reporting.

PyTest
pytest --cov=[1]
Drag options to blanks, or click blank then click option'
Amy_module
Btests
Csetup.py
DREADME.md
Attempts:
3 left
💡 Hint
Common Mistakes
Using the test folder name instead of the module name.
Trying to measure coverage on non-Python files.
2fill in blank
medium

Complete the command to generate a coverage report in the terminal.

PyTest
pytest --cov=my_module --cov-report=[1]
Drag options to blanks, or click blank then click option'
Ahtml
Bterm
Cxml
Djson
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'html' when expecting terminal output.
Using 'xml' or 'json' which generate files instead.
3fill in blank
hard

Fix the error in the command to generate an HTML coverage report.

PyTest
pytest --cov=my_module --cov-report=[1]
Drag options to blanks, or click blank then click option'
Ajson
Bxml
Cterm
Dhtml
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'term' which only shows output in the terminal.
Using 'xml' or 'json' which create different file formats.
4fill in blank
hard

Fill both blanks to run pytest with coverage for app and generate both terminal and XML reports.

PyTest
pytest --cov=[1] --cov-report=[2] --cov-report=xml
Drag options to blanks, or click blank then click option'
Aapp
Bterm
Chtml
Djson
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'html' instead of 'term' for terminal output.
Using a wrong module name.
5fill in blank
hard

Fill all three blanks to run pytest with coverage for service, generate an HTML report, and fail if coverage is below 80%.

PyTest
pytest --cov=[1] --cov-report=[2] --cov-fail-under=[3]
Drag options to blanks, or click blank then click option'
Aservice
Bhtml
C80
Dterm
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'term' instead of 'html' for the report.
Setting the fail-under value too high or too low.
Using the wrong module name.