CodeVetter · Repo Unpack · Feature catalog
pytest-dev/pytest
The primary user experience is selecting tests, discovering executable items, and receiving diagnostic reports. Fixtures and parametrization support reusable resources and generated test cases. Built-in integrations cover unittest, doctests, capture, logging, subtests, and machine-readable output. This catalog groups inspected capabilities into eight areas; it is bounded rather than an exhaustive listing of every CLI option.
- Users can run tests through pytest.main(args, plugins), while --collect-only skips execution after collection and collection errors stop the loop unless continuation is enabled.
- Python discovery selects .py modules using python_files unless explicitly selected, creates Class or Function nodes, and expands parametrized calls through pytest_generate_tests and Metafunc.
- -k evaluates case-insensitive substring matches across collected names and extra keywords; -m evaluates marker expressions, including matching marker keyword arguments.
- Fixtures support cached resource reuse, dependency-aware finalization, yield-based teardown, and monkeypatch operations that are undone after the requesting test or fixture finishes.
- Assertion rewriting compiles transformed test ASTs for detailed failures; public helpers include approx, raises, RaisesGroup, warns, and deprecated_call, while skip and xfail marks alter setup and reporting.
- Capture supports fd, sys, no, and tee-sys modes with -s disabling capture; caplog exposes messages, formatted text, LogRecord objects, tuples, and clearing.
- Built-in collection recognizes concrete unittest.TestCase subclasses and doctests from modules or text files; subtests.test provides individual reporting inside a test function.
- Run management includes last-failed filtering, failed-first ordering, cache inspection, and stepwise continuation; reporting includes terminal status output, JUnit XML, and opt-in pastebin publication.