An overview of assorted plugins
Now, we will take a look at some useful and/or interesting plugins. Of course, it is not possible to cover all plugins here, so we will try to cover the ones that cover popular frameworks and general capabilities, with a few obscure plugins thrown in. Of course, this barely scratches the surface, but let's get to it.
pytest-xdist
This is a very popular plugin and is maintained by the core developers; it allows you to run tests under multiple CPUs, to speed up the test run.
After installing it, simply use the -n
command-line flag to use the given number of CPUs to run the tests:
λ pytest -n 4
And that's it! Now, your tests will run across four cores and hopefully speed up the test suite quite a bit, if it is CPU intensive, thought I/O-bound tests won't see much improvement, though. You can also use -n auto
to let pytest-xdist
automatically figure out the number of CPUs you have available.
Note
Keep in mind that when your tests are running concurrently, and in random...