With this plugin template change functional tests can now be marked to run in parallel. If left unmarked, they will run serially as they always have.
Marking tests
Mark your tests with @pytest.mark.parallel
. For example, here is one in use in pulpcore. This example is on a class, but this can also be on individual tests.
Controlling parallelization
A new template_config.yaml
named parallel_test_workers
which defaults to 8. By adjusting this value you can specify the number of test concurrency. For example, the default of 8 will run 8 independent processes each running tests, providing a concurrency of 8. Setting to 0 will disable the parallel section of the test runner altogether.
Where do these marks come from?
pulp-smash provides the parallel
and serial
marks here. You can list all known marks locally with pytest --markers
.
What is providing this fanciness?
A project called pytest-xdist
which is now a dependency of pulp-smash
.
Can I group parallel tests to have them run serially with respect to others in the group?
Yes, pytest-xdist
provides this. See the docs on the pytest.mark.xdist_group
.