A pytest plugin which allows to (de-)select tests from a file.
Project description
This is a pytest plugin which allows to (de-)select tests by name from a list loaded from a file.
Usage
This plugin adds two comamnd line options to pytest:
–select-from-file
–deselect-from-file
Both expect an argument that resolves to a UTF-8 encoded text file containing one test name per line.
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.
Example:
$~ cat selection.txt test_something test_parametrized[1] tests/test_foo.py::test_other $~ pytest --select-from-file selection.txt $~ pytest --deselect-from-file selection.txt
Questions
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.
What is this useful for
The author uses this plugin to split tests across workers on Circle CI.
Example:
pytest --collect-only --quiet | \ grep '::' | \ circleci tests split --split-by=timings > selected.txt pytest --select-from-file selected.txt
Version History
- v0.1.0 - 2018-12-08:
Initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pytest-select-0.1.0.tar.gz
.
File metadata
- Download URL: pytest-select-0.1.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.10 CPython/3.6.4 Darwin/18.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56bed91c87acd9ae6013a194091cb9694e1b0044bd3978a2d739f92fd4a52c40 |
|
MD5 | c22a52821f3e4c0833f0ea0663c485d9 |
|
BLAKE2b-256 | f42591c3056608835f9280374ef8775999edaaaf5d1f40704f31e5ceb63029f5 |
File details
Details for the file pytest_select-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: pytest_select-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.10 CPython/3.6.4 Darwin/18.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 998d991d13c54c3b3ffd180596a0a54f286583e06537550bb499f4e50ce17f57 |
|
MD5 | f6e8a0f56193efb3a3246e215924f661 |
|
BLAKE2b-256 | 5a0e01959cb0f4230ba55f603ad094f5c0b3a5e53252411e9583128cb5c20e4e |