Test Marker
Pronunciationtest MAR-ker
Definition
A test marker is a label on a test that changes how it runs: skip leaves it out, xfail expects it to fail, and custom markers like slow let you select groups.
Where you hear it
In pytest suites, CI configuration that runs fast tests first, and known-bug workarounds.
Examples
Mark the test
xfailuntil the bug is fixed.Run
pytest -m "not slow"for the quick feedback loop.The slow integration tests are marked, so the quick run skips them.
Common mistake
Using skip to hide a failing test and forgetting it. Add a reason and a ticket, and review skipped tests.
Don't confuse with
Deleting the test. A marker keeps it visible while saying it is known to fail or be slow.
Say it at work
- In a meeting or chat
Add a reason to the skip marker.
- In an email or ticket
Tag the slow tests so CI can run them nightly.
Keep exploring
More in Testing & Quality