0
0
PyTesttesting~10 mins

pytest-xdist for parallel execution - Interactive Code Practice

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

Complete the command to load the pytest-xdist plugin for parallel test execution.

PyTest
pytest -p [1]
Drag options to blanks, or click blank then click option'
Aparallel
Bpytest_xdist
Cxdist
Dmultiprocessing
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'parallel' or 'multiprocessing' which are not pytest-xdist plugin names.
Using 'pytest_xdist' which is not the registered plugin specifier.
2fill in blank
medium

Complete the command to run tests in parallel using 4 CPUs with pytest-xdist.

PyTest
pytest -n [1]
Drag options to blanks, or click blank then click option'
A2
B1
C8
D4
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-n 1' which runs tests sequentially.
Using numbers higher than available CPUs causing slowdowns.
3fill in blank
hard

Fix the error in the pytest command to enable parallel execution with pytest-xdist.

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

Fill both blanks to create a pytest command that runs tests in parallel and stops after 2 failures.

PyTest
pytest [1] 5 [2] 2
Drag options to blanks, or click blank then click option'
A-n
B-x
C--maxfail
D-k
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing '-x' with '--maxfail'.
Using '-k' which filters tests but does not control failures.
5fill in blank
hard

Fill all three blanks to write a pytest command that runs tests in parallel on 3 CPUs, stops after 1 failure, and runs only tests matching 'login'.

PyTest
pytest [1] 3 [2] 1 [3] login
Drag options to blanks, or click blank then click option'
A-n
B--maxfail
C-k
D-x
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up '-x' and '--maxfail'.
Forgetting to use '-k' for test name filtering.