0
0
PyTesttesting~10 mins

Parallel execution in CI in PyTest - 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 tests in parallel using the pytest-xdist plugin.

PyTest
pytest.main(['-n', '[1]'])
Drag options to blanks, or click blank then click option'
A0
B4
C1
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 or 1 disables parallelism.
Forgetting to install pytest-xdist plugin.
2fill in blank
medium

Complete the GitHub Actions step to run pytest tests in parallel with 3 workers.

PyTest
run: pytest -n [1]
Drag options to blanks, or click blank then click option'
A3
B1
C5
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 disables parallelism.
Using 1 runs tests sequentially.
3fill in blank
hard

Fix the error in the pytest command to enable parallel execution with 4 workers.

PyTest
pytest [1] 4
Drag options to blanks, or click blank then click option'
A4
B-n
Cn
D-N
Attempts:
3 left
💡 Hint
Common Mistakes
Using '--n' instead of '-n'.
Using uppercase '-N' which is invalid.
4fill in blank
hard

Fill both blanks to create a pytest command that runs tests in parallel and shows detailed output.

PyTest
pytest [1] [2]
Drag options to blanks, or click blank then click option'
A-n 4
B-v
C--maxfail=1
D-x
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-x' which stops after first failure instead of verbose output.
Using '--maxfail=1' which limits failures but does not affect parallelism.
5fill in blank
hard

Fill all three blanks to configure pytest in GitHub Actions to run tests in parallel, stop after 2 failures, and show verbose output.

PyTest
pytest [1] [2] [3]
Drag options to blanks, or click blank then click option'
A-n 3
B-v
C--maxfail=2
D-x
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-x' which stops after first failure instead of '--maxfail=2'.
Not combining options correctly.