A Pytest plugin for test-case prioritization.
This pytest plugin allows you to find failures faster and receive sooner debugging feedback from CI. It does so by prioritizing running tests that have shorter execution time and/or recently failed.
To install "pytest-tcp" via pip from PyPI:
pip install pytest-tcpPytest will automatically find the plugin and use it when you run pytest.
You can use the default prioritization heuristic,
which runs tests that have shorter execution time first
by passing the --tcp option:
pytest --tcpThe terminal output will tell you the current configurations and runtime overhead of this plugin:
Using TCP weights 1-0 Collect TCP features took 0.0029001235961914062s. Compute TCP order took 0.0002548694610595703s.
You can configure the weights of different prioritization heuristics
by additionally passing the `--tcp-weight flag with formatted values:
pytest --tcp --tcp-weight=0-1Weights are separated by hyphens -.
The 1st weight is for running faster tests,
the 2nd weight is for running recently failed tests.
The sum of all weights must equal to 1.
A higher weight means that a corresponding heuristic is favored.
The default value is 1-0, meaning it entirely favors running faster tests.
You can make these options always apply by adding them to the addopts setting in your
pytest.ini:
[pytest]
addopts = --tcp --tcp-weight=0.5-0.5Contributions are very welcome. Tests can be run with tox.
Distributed under the terms of the MIT license, "pytest-tcp" is free and open source software
If you encounter any problems, please file an issue along with a detailed description.