February 2022
Intermediate to advanced
274 pages
6h 28m
English
Using markers for test selection is a powerful pytest capability to help run a subset of tests. Walking through these exercises will help you get comfortable with them.
The directory /path/to/code/ch6/exercises has a couple of files:
| | exercises/ch6 |
| | ├── pytest.ini |
| | └── test_markers.py |
test_markers.py includes seven test cases:
| | $ cd ch6/exercises |
| | $ pytest -v |
| | ========================= test session starts ========================== |
| | collected 7 items |
| | |
| | test_markers.py::test_one PASSED [ 14%] |
| | test_markers.py::test_two PASSED [ 28%] |
| | test_markers.py::test_three PASSED [ 42%] |
| | test_markers.py::TestClass::test_four PASSED [ 57%] |
| | test_markers.py::TestClass::test_five PASSED [ 71%] |
| | test_markers.py::test_param[6] PASSED ... |
Read now
Unlock full access