0
0
PyTesttesting~10 mins

pytest-cov setup - Interactive Code Practice

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

Complete the code to install pytest-cov using pip.

PyTest
pip install [1]
Drag options to blanks, or click blank then click option'
Apytest
Bpytest-cov
Ccoverage
Dpytest-covure
Attempts:
3 left
💡 Hint
Common Mistakes
Installing 'coverage' instead of 'pytest-cov'.
Misspelling the package name.
2fill in blank
medium

Complete the pytest command to run tests with coverage report in terminal.

PyTest
pytest --cov=[1]
Drag options to blanks, or click blank then click option'
Atests
Bsrc
Cmy_package
Ddocs
Attempts:
3 left
💡 Hint
Common Mistakes
Using the tests folder instead of the source code folder.
Using unrelated folder names.
3fill in blank
hard

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

PyTest
pytest --cov=my_package --cov-report=[1]
Drag options to blanks, or click blank then click option'
Ahtml
Bjson
Cterm
Dxml
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'xml' or 'json' instead of 'html' for HTML report.
Omitting the report option.
4fill in blank
hard

Fill both blanks to add coverage options in pytest.ini configuration file.

PyTest
[pytest]
addopts = --cov=[1] --cov-report=[2]
Drag options to blanks, or click blank then click option'
Amy_package
Bterm-missing
Chtml
Dtests
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'tests' instead of source folder for coverage.
Using 'html' instead of 'term-missing' for terminal report.
5fill in blank
hard

Fill all three blanks to ignore test files and enable coverage for source code in setup.cfg.

PyTest
[tool:pytest]
addopts = --cov=[1] --cov-report=[2] --cov-fail-under=[3]
Drag options to blanks, or click blank then click option'
Asrc
Bterm
C80
Dtests
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'tests' folder for coverage target.
Omitting the fail-under option or setting it too high.