This repository was archived by the owner on May 29, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -53,9 +53,10 @@ pytest --tests-per-worker auto
5353pytest --workers 2 --tests-per-worker auto
5454```
5555
56- ## Markers
56+ ## Non parallel runs
5757
58- Use ` @pytest.mark.sequence ` , to mark tests, that shouldn't run in parallel mode.
58+ Use ` @pytest.mark.sequence ` to mark tests, that shouldn't run in parallel mode.
59+ Use fixture ` sequence ` to mark fixtures or tests, that shouldn't run in parallel mode.
5960
6061## Notice
6162
Original file line number Diff line number Diff line change @@ -103,6 +103,15 @@ def run(self):
103103 pass
104104
105105
106+ @pytest .fixture
107+ def sequence ():
108+ """
109+ Fixture moves test to sequence execution.
110+ Fixture can be used with another fixture.
111+ """
112+ pass
113+
114+
106115@pytest .mark .trylast
107116def pytest_configure (config ):
108117 workers = parse_config (config , 'workers' )
@@ -297,7 +306,7 @@ def pytest_runtestloop(self, session):
297306 self .responses_queue = queue_cls ()
298307
299308 for i , item in enumerate (session .items ):
300- if "sequence" in [mark .name for mark in item .own_markers ]:
309+ if "sequence" in [mark .name for mark in item .own_markers ] or "sequence" in item . _fixtureinfo . names_closure :
301310 sequence_queue .put (i )
302311 else :
303312 parallel_queue .put (i )
You can’t perform that action at this time.
0 commit comments