CodeVetter · Repo Unpack · Data flow
pytest-dev/pytest
Arguments, environment options, configuration files, and plugins feed a mutable Config. Collection turns selected paths and node identifiers into Session items, and fixtures resolve those items' dependencies into function arguments. Runtime hooks produce reports containing outcomes and captured output. Report consumers render terminal output, serialize XML, and update cross-session failure state.
- Config.parse prepends PYTEST_ADDOPTS to explicit arguments, discovers configuration, then prepends configuration addopts, yielding configuration options followed by environment options and explicit arguments.
- Named configuration loaders are ordered from pytest.toml and .pytest.toml through INI, pyproject.toml, tox.ini, and setup.cfg; locate_config walks argument paths and their parents and returns the first valid configuration.
- Without explicit test arguments, _decide_args uses testpaths when invoked at rootpath, otherwise falls back to the invocation directory; pyargs changes testpaths handling from glob expansion to package arguments.
- Session.perform_collect resolves selection arguments, normalizes duplicates and overlaps unless keepduplicates is set, recursively expands collectors, then passes the item list through pytest_collection_modifyitems.
- Module.collect registers xunit setup fixtures and fixture factories; _genfunctions passes fixture information into Metafunc and produces one Function per callspec after pruning shadowed dependencies.
- TopRequest._fillfixtures stores resolved values in item.funcargs; pytest_pyfunc_call extracts only declared fixture argument names and calls the test with keyword arguments.
- CaptureManager attaches phase stdout and stderr sections to items; call_and_report wraps a phase in CallInfo, requests a TestReport, and sends it to logreport consumers such as TerminalReporter.
- LFPlugin converts cached strings to NodeId objects, updates failure membership from reports, and serializes changed history back to JSON; JUnit output separately writes an XML testsuites tree to the configured logfile.