Answer the question
In order to leave comments, you need to log in
How to run Pytest tests in parallel across categories?
Good day!
Brief background of the problem:
there are a bunch of tests (methods) that are currently grouped into separate test suites (in the form of separate py files):
*test_suite_1.py
**def test_case_1_1()
**def test_case_1_2()
...
*test_suite_2 .py
**def test_case_2_1()
**def test_case_2_2()
...
For parallel execution, I found the xdist plugin.
Accordingly, when pytest is launched, it bypasses all the tests in turn, but in parallel, the tests are executed first from test_suite_1.py, and so on ..
The question is, how can you make tests run in parallel across test suites (packages, packs...)? That is, so that the first browser instance executes test_suite_1.py, the second one executes test_suite_2.py, and so on?
I did not find (or did not understand) in the xdist documentation how to implement my task. Maybe there are some other plugins or an implementation of this method in xdist?
PS: my experience in programming and using pytest is not that great (=
Answer the question
In order to leave comments, you need to log in
Is there seriously no off-line documentation?
xdist
--dist=loadscope: tests will be grouped by module for test functions and by class for test methods, then each group will be sent to an available worker, guaranteeing that all tests in a group run in the same process. This can be useful if you have expensive module-level or class-level fixtures. Currently the groupings can't be customized, with grouping by class takes priority over grouping by module. This feature was added in version 1.19.
--dist=loadfile: tests will be grouped by file name, and then will be sent to an available worker, guaranteeing that all tests in a group run in the same worker. This feature was added in version 1.21.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question