@@ -93,12 +93,17 @@ those fixtures are shared between threads.
9393 as errors.
9494
9595
96- - Four corresponding markers:
96+ - Five corresponding markers:
9797 - ` pytest.mark.parallel_threads_limit(n) ` to mark a single test to
9898 run in a maximum of ` n ` threads, even if the ` --parallel-threads `
9999 command-line argument is set to a higher value. This is useful if a
100100 test uses resources that should be limited.
101- - ` pytest.mark.parallel_threads(n) ` to mark a test to always run in ` n `
101+ - ` pytest.mark.force_parallel_threads(n) ` to force a test to always run
102+ in ` n ` threads, overriding both the ` --parallel-threads ` command-line
103+ argument and any ` parallel_threads_limit ` marker. Use this when a
104+ test must always be multi-threaded with a specific thread count.
105+ - ` pytest.mark.parallel_threads(n) ` (deprecated when ` n > 1 ` — use
106+ ` force_parallel_threads ` instead) to mark a test to always run in ` n `
102107 threads. Note that this implies that the test will be multi-threaded
103108 just because pytest-run-parallel is installed, even if
104109 ` --parallel-threads ` is not passed at the command-line.
@@ -130,8 +135,9 @@ temporary directory in that fixture.
130135When using the fixtures ` thread_index ` and ` iteration_index ` , they should be
131136requested directly by tests, and will return 0 when requested by other fixtures.
132137
133- ** Note** : It's possible to specify ` --parallel-threads=auto ` or
134- ` pytest.mark.parallel_threads("auto") ` which will let
138+ ** Note** : It's possible to specify ` --parallel-threads=auto ` ,
139+ ` pytest.mark.force_parallel_threads("auto") ` , or
140+ ` pytest.mark.parallel_threads_limit("auto") ` which will let
135141` pytest-run-parallel ` choose the number of logical CPU cores available
136142to the testing process. If that cannot be determined, the number of
137143physical CPU cores will be used. If that fails as well, it will fall
@@ -260,7 +266,7 @@ Note that using `pytest-xdist` and setting `iterations` to a number
260266greater than one might cause tests to run even more times than intended.
261267
262268The other mode of operation occurs at the individual test level, via the
263- ` pytest.mark.parallel_threads ` and ` pytest.mark.iterations ` markers:
269+ ` pytest.mark.force_parallel_threads ` and ` pytest.mark.iterations ` markers:
264270
265271``` python
266272# test_file.py
@@ -270,15 +276,15 @@ import pytest
270276def my_fixture ():
271277 ...
272278
273- @pytest.mark.parallel_threads (2 )
279+ @pytest.mark.force_parallel_threads (2 )
274280@pytest.mark.iterations (10 )
275281def test_something_1 ():
276282 # This test will be run in parallel using two concurrent threads
277283 # and 10 times in each thread
278284 ...
279285
280286@pytest.mark.parametrize (' arg' , [1 , 2 , 3 ])
281- @pytest.mark.parallel_threads (3 )
287+ @pytest.mark.force_parallel_threads (3 )
282288def test_fixture (my_fixture , arg ):
283289 # pytest markers and fixtures are supported as well
284290 ...
0 commit comments