pytest-xdist
pytest-xdist copied to clipboard
Any way to run the groups of tests in sequence and run the test under each group in parallel
Any way to run the groups of tests in sequence and run the test under each group in parallel?
In the example setup below, I want to run my tests by groups/batch sequentially and then run the tests under each group in parallel. Sample run: Run first group2 and run test4 and test5 in parallel. After group2 is completed, run group1 and run test1, test2 and test3 in parallel. So on and so forth. Any idea how can I achieve this setup? I would really appreciate the help.
Group1:
- test1
- test2
- test3 Group2:
- test4
- test5 Group3:
- test6
- test7
- test8
Hi @robertdeocampojr,
I don't think that specific use case has emerged before, I suppose you will have to write your own scheduler (or extend one of the existing ones).
If you can execute pytest more than once easily (say you run your tests via a custom invoke task), you could run pytest twice: once for the non-grouped tests, sequentially, and another run for the grouped tests, using pytest-xdist and --dist loadgroup.