0
0
PyTesttesting~10 mins

Running with -n auto 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 -n auto option.

PyTest
pytest.main(['test_sample.py', '-n', '[1]'])
Drag options to blanks, or click blank then click option'
Aauto
Bparallel
Call
Dthreads
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-n all' which is not a valid option.
Using '-n threads' which is incorrect syntax.
2fill in blank
medium

Complete the command to run pytest with parallel execution automatically detecting CPU cores.

PyTest
pytest [1] test_module.py
Drag options to blanks, or click blank then click option'
A-m auto
B-n 4
C-x
D-n auto
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-n 4' which fixes the number of workers instead of auto.
Using '-x' which stops after first failure.
3fill in blank
hard

Fix the error in the pytest command to enable automatic parallel test execution.

PyTest
pytest -n [1] test_parallel.py
Drag options to blanks, or click blank then click option'
Acpu
Bauto
Cmax
Dall
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'all' which is not recognized by pytest-xdist.
Using 'max' or 'cpu' which are invalid options.
4fill in blank
hard

Fill both blanks to run pytest in parallel with automatic CPU detection and verbose output.

PyTest
pytest [1] [2] tests/
Drag options to blanks, or click blank then click option'
A-n auto
B-v
C-q
D--maxfail=1
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-q' which reduces output instead of verbose.
Using '--maxfail=1' which stops tests early, not related to parallelism.
5fill in blank
hard

Fill all three blanks to run pytest with automatic parallelism, verbose output, and stop after first failure.

PyTest
pytest [1] [2] [3] my_tests/
Drag options to blanks, or click blank then click option'
A-n auto
B-v
C-x
D--maxfail=2
Attempts:
3 left
💡 Hint
Common Mistakes
Using '--maxfail=2' which stops after two failures, not first.
Omitting '-v' which reduces output detail.