_pytest.main module

core implementation of testing process: init, session, runtest loop.

pytest_addoption(parser)[source]
wrap_session(config: _pytest.config.Config, doit: Callable[[_pytest.config.Config, Session], Optional[Union[int, _pytest.config.ExitCode]]]) → Union[int, _pytest.config.ExitCode][source]

Skeleton command line program

pytest_cmdline_main(config)[source]
_main(config: _pytest.config.Config, session: _pytest.main.Session) → Optional[Union[int, _pytest.config.ExitCode]][source]

default command line protocol for initialization, session, running tests and reporting.

pytest_collection(session)[source]
pytest_runtestloop(session)[source]
_in_venv(path)[source]

Attempts to detect if path is the root of a Virtual Environment by checking for the existence of the appropriate activate script

pytest_collection_modifyitems(items, config)[source]
exception NoMatch[source]

Bases: Exception

raised if matching cannot locate a matching names.

exception Failed[source]

Bases: Exception

signals a stop as failed test run.

class _bestrelpath_cache(path: py._path.local.LocalPath)[source]

Bases: dict

class Session(*k, **kw)[source]

Bases: _pytest.nodes.FSCollector

exception Interrupted

Bases: KeyboardInterrupt

signals an interrupted test run.

exception Failed

Bases: Exception

signals a stop as failed test run.

_setupstate: SetupState = None
_fixturemanager: FixtureManager = None
exitstatus: Union[int, ExitCode] = None
classmethod from_config(config)[source]
_node_location_to_relpath(node_path: py._path.local.LocalPath)str[source]
pytest_collectstart()[source]
pytest_ignore_collect(path: py._path.local.LocalPath, config: _pytest.config.Config) → Optional[Tuple[Literal[True], Optional[str]]][source]
pytest_runtest_logreport(report)[source]
pytest_collectreport(report)
isinitpath(path)[source]
gethookproxy(fspath: py._path.local.LocalPath)[source]
pytest_deselected(items)[source]

Keep track of explicitly deselected items.

perform_collect(args=None, genitems=True)[source]
_perform_collect(args, genitems)[source]
for ... in collect()[source]

returns a list of children (items and collectors) for this collection node.

for ... in _collect(argpath, names)[source]
staticmethod _visit_filter(f)[source]
_tryconvertpyarg(x)[source]

Convert a dotted module name to path.

staticmethod _parse_fname_lineno(arg: str) → Tuple[str, Tuple[Optional[int], Optional[int]]][source]
_parsearg(arg)[source]

return (fspath, names) tuple after checking the file exists.

matchnodes(matching, names)[source]
_matchnodes(matching, names)[source]
for ... in genitems(node)[source]