0
0
Flaskframework~10 mins

Coverage reporting in Flask - Interactive Code Practice

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

Complete the code to start coverage measurement in a Flask app test.

Flask
import coverage
cov = coverage.[1]()
cov.start()
Drag options to blanks, or click blank then click option'
ACoverage
Bstart
Ccoverage
Drun
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase 'coverage' instead of 'Coverage'
Calling 'start' instead of creating the coverage object
2fill in blank
medium

Complete the code to stop coverage measurement and save the report.

Flask
cov.stop()
cov.[1]()
Drag options to blanks, or click blank then click option'
Astart
Breport
Cerase
Dsave
Attempts:
3 left
💡 Hint
Common Mistakes
Calling 'report' instead of 'save' before generating the report
Calling 'start' again instead of saving
3fill in blank
hard

Fix the error in generating an HTML coverage report.

Flask
cov.[1](directory='coverage_html_report')
Drag options to blanks, or click blank then click option'
Ahtml_reporter
Bhtml_report
Chtml_reporter_dir
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'html_reporter' or similar incorrect method names
Passing wrong argument names
4fill in blank
hard

Fill both blanks to create a coverage report for specific files and omit tests.

Flask
cov = coverage.Coverage(source=[[1]], omit=[[2]])
Drag options to blanks, or click blank then click option'
A'app'
B'tests/*'
C'main.py'
D'docs/*'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'tests/*' as source instead of omit
Omitting the app folder instead of tests
5fill in blank
hard

Fill all three blanks to correctly configure coverage to start, stop, and save in a Flask test setup.

Flask
cov = coverage.[1](branch=True)
cov.[2]()
# run tests
cov.[3]()
Drag options to blanks, or click blank then click option'
ACoverage
Bstart
Csave
Dstop
Attempts:
3 left
💡 Hint
Common Mistakes
Calling 'save()' before stopping coverage
Not creating the coverage object properly