February 2022
Intermediate to advanced
274 pages
6h 28m
English
Custom markers are markers we make up ourselves and apply to tests. Think of them like tags or labels. Custom markers can be used to select tests to run or skip.
To see custom markers in action, let’s take a look at a couple of tests for the “start” behavior:
| | import pytest |
| | from cards import Card, InvalidCardId |
| | |
| | |
| | def test_start(cards_db): |
| | """ |
| | start changes state from "todo" to "in prog" |
| | """ |
| | i = cards_db.add_card(Card("foo", state="todo")) |
| | cards_db.start(i) |
| | c = cards_db.get_card(i) |
| | assert c.state == "in prog" |
| | |
| | |
| | def test_start_non_existent(cards_db): |
| | """ |
| | Shouldn't be able to start a non-existent card. |
| | """ |
| | any_number ... |
Read now
Unlock full access