0
0
PyTesttesting~10 mins

Why CI integration enables continuous quality in PyTest - Test Your Understanding

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

Complete the code to run tests automatically in CI.

PyTest
def test_addition():
    assert 2 + 2 == [1]
Drag options to blanks, or click blank then click option'
A4
B5
C3
D22
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a wrong sum like 5 or 3.
2fill in blank
medium

Complete the code to mark a test to run in CI only.

PyTest
@pytest.mark.[1]
def test_feature():
    assert True
Drag options to blanks, or click blank then click option'
Aci
Bskip
Cslow
Dxfail
Attempts:
3 left
💡 Hint
Common Mistakes
Using skip or slow markers which do not indicate CI.
3fill in blank
hard

Fix the error in the test command to run tests in CI.

PyTest
pytest [1] tests/
Drag options to blanks, or click blank then click option'
A--run
B-m ci
C--ci
D-run
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect flags like --run or --ci.
4fill in blank
hard

Fill both blanks to create a test that fails if coverage is below 80%.

PyTest
pytest --cov=myapp --cov-fail-under=[1] --cov-report=[2]
Drag options to blanks, or click blank then click option'
A80
B90
Cterm-missing
Dhtml
Attempts:
3 left
💡 Hint
Common Mistakes
Using too high coverage threshold or wrong report type.
5fill in blank
hard

Fill all three blanks to create a test report dictionary filtering passed tests.

PyTest
report = {test: result for test, result in results.items() if result [1] 'passed' and test.startswith([2]) and len(test) [3] 10}
Drag options to blanks, or click blank then click option'
A==
B'test_'
C<
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' instead of '==' or wrong string prefix.