A pytest plugin for ensuring max suite time.
Really though, it's: if the timeout expires, no new tests are started.
Works great in conjunction with pytest-repeat.
Say your debugging a flaky test and just want to run it a bunch of times, but not longer than say 10 minutes (600 seconds).
After installing both pytest-repeat
and pytest-suite-timeout
you can say:
$ pytest test_something.py::test_func --count=1000 --suite-timeout=600
That will run a test 1000 times, if that's less than 600 seconds. If it takes longer than 600 seconds, it will stop running new tests after 600 seconds.
From PyPI:
$ pip install pytest-suite-timeout
Specify the max suite time with --suite-timeout
, in seconds (float).
Example of max 90 seconds:
$ pytest --suite-timeout=90
If you don't pass in --suite-timeout
, nothing happens.
Timeout is done between tests.
If a timeout is noticed, pytest.exit()
is called, stopping all further testing.
Contributions are welcome. Tests can be run with tox. Test coverage is now 100%. Please make sure to keep it at 100%. If you have an awesome pull request and need help with getting coverage back up, let me know.
Distributed under the terms of the MIT license, "pytest-suite-timeout" is free and open source software
If you encounter any problems, please file an issue along with a detailed description.
See changelog.md