Sort tests by their last duration, slowest first.
This pytest plugin was generated with Cookiecutter along with @hackebrot's cookiecutter-pytest-plugin template.
- Sort tests on consecutive runs by their last duration, slowest first.
- Works with pytest-xdist by pre-assigning tests to workers based on their last duration.
- pytest
- pytest-xdist (optional)
You can install "pytest-slowest-first" via pip from PyPI:
$ pip install pytest-slowest-first
For best results, use this plugin with pytest-xdist to run tests in parallel.
When used together, make sure to pass --dist=loadgroup
to pytest to
ensure that tests are distributed evenly across workers.
Example command line:
$ pytest --sf -n auto --dist=loadgroup
Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.
Distributed under the terms of the MIT license, "pytest-slowest-first" is free and open source software
If you encounter any problems, please file an issue along with a detailed description.