A pytest plugin which allows to (de-)select tests from a file.
This is a pytest plugin which allows to (de-)select tests by name from a list loaded from a file.
It’s recommended to install this package from PyPI:
pip install pytest-select
This plugin adds new command line options to pytest:
The first two both expect an argument that resolves to a UTF-8 encoded text file containing one test name per line.
The third one changes the behaviour in case (de-)selected test names are missing from the to-be executed tests. By default a warning is emitted and the remaining selected tests are executed as normal. By using the --select-fail-on-missing flag this behaviour can be changed to instead abort execution in that case.
Test names are expected in the same format as seen in the output of pytest --collect-only --quiet for example.
Both plain test names or complete node ids (e.g. test_file.py::test_name) are accepted.
$~ cat selection.txt test_something test_parametrized tests/test_foo.py::test_other $~ pytest --select-from-file selection.txt $~ pytest --deselect-from-file selection.txt
This package uses Poetry. To setup a development environment install Poetry and then run:
Why not use pytest’s builtin -k option
The -k selection mechanism is (currently) unable to deal with selecting multiple parametrized tests and is also a bit fragile since it matches more than just the test name. Additionally, depending on the number of tests, giving test names on the command line can overflow the maximum command length.
- v0.1.2 - 2019-01-18:
- Add informational pytest header report output
- v0.1.1 - 2018-12-10:
- Add --select-fail-on-missing option
- Add basic mutation testing
- v0.1.0post0 - 2018-12-08:
- Fix README
- v0.1.0 - 2018-12-08:
- Initial release
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size pytest_select-0.1.2-py3-none-any.whl (7.5 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size pytest-select-0.1.2.tar.gz (4.3 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for pytest_select-0.1.2-py3-none-any.whl