Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to run tests with coverage in Django.
Django
coverage run --source='.' manage.py [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'runserver' instead of 'test' will start the server, not run tests.
Using 'migrate' runs database migrations, not tests.
✗ Incorrect
Use test to run Django tests with coverage.
2fill in blank
mediumComplete the command to generate a coverage report in the terminal.
Django
coverage [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' again instead of 'report' will rerun tests.
Using 'html' generates a report in a browser, not terminal.
✗ Incorrect
The report command shows coverage results in the terminal.
3fill in blank
hardFix the error in the command to generate an HTML coverage report.
Django
coverage [1] -d coverage_html Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'report' outputs text, not HTML files.
Using 'run' reruns tests, not generate reports.
✗ Incorrect
The html command generates an HTML report in the specified directory.
4fill in blank
hardFill both blanks to create a coverage report that omits tests folder and shows missing lines.
Django
coverage report --omit=[1] --[2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'html' or 'xml' instead of 'show-missing' will change report format.
Not omitting tests folder will include test code in coverage.
✗ Incorrect
Use --omit=tests/* to skip test files and --show-missing to list uncovered lines.
5fill in blank
hardFill all three blanks to run tests with coverage, generate HTML report, and erase old data.
Django
coverage [1] && coverage [2] --source='.' manage.py test && coverage [3] -d htmlcov
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' in the first blank will combine old data with new.
Skipping 'erase' may cause outdated coverage info.
✗ Incorrect
First erase old data, then run tests with run, finally generate HTML report with html.