--tb
The pytest option that chooses how much of each failure's traceback to print, from long to short to none.
In more detail
--tb=short keeps each failure to a few lines, and --tb=no hides tracebacks so only the summary remains, which is handy when you want to count failures rather than read them. The default, --tb=auto, prints the long form for the first and last entries and short for the rest.
Example
pytest -q --tb=short test_cart.pyRelated terms
- stack trace — The list of function calls that were running when an error happened, printed to help a developer find where it came from; Python calls it a traceback.
- failure report — What the test runner prints when a test fails: which test, which line, and the values that did not match.
- short test summary — The block at the end of a pytest run that lists each failed, skipped or expected-to-fail test on one line.
Taught in
- The Cost And Value Of A Test — Automated Testing, TDD & Quality Engineering
- One Assertion Per Reason — Automated Testing, TDD & Quality Engineering
- Parametrised Tests — Automated Testing, TDD & Quality Engineering