February 2022
Intermediate to advanced
274 pages
6h 28m
English
Let’s say we want to add the “smoke” marker to test_start_non_existent, like we did for test_finish_non_existent. However, we happen to misspell “smoke” as “smok” like this:
| » | @pytest.mark.smok |
| | @pytest.mark.exception |
| | def test_start_non_existent(cards_db): |
| | """ |
| | Shouldn't be able to start a non-existent card. |
| | """ |
| | any_number = 123 # any number will be invalid, db is empty |
| | with pytest.raises(InvalidCardId): |
| | cards_db.start(any_number) |
If we try to run this “smoke” test, we’ll get a familiar warning:
| | $ cd /path/to/code/ch6/bad |
| | $ pytest -m smoke |
| | ========================= test session starts ========================== |
| | collected 12 items / 5 deselected / 7 ... |
Read now
Unlock full access