_pytest.runner module

basic collect and runtest protocol implementations

pytest_addoption(parser)[source]
pytest_terminal_summary(terminalreporter)[source]
pytest_sessionstart(session)[source]
pytest_sessionfinish(session)[source]
pytest_runtest_protocol(item: Item, nextitem: Optional[Item])bool[source]
runtestprotocol(item: Item, log: bool = True, nextitem: Optional[Item] = None) → List[_pytest.reports.TestReport][source]
show_test_item(item)[source]

Show test function, parameters and the fixtures of the test item.

pytest_runtest_setup(item)[source]
pytest_runtest_call(item)[source]
pytest_runtest_teardown(item, nextitem)[source]
_update_current_test_var(item, when)[source]

Update PYTEST_CURRENT_TEST to reflect the current item and stage.

If when is None, delete PYTEST_CURRENT_TEST from the environment.

pytest_report_teststatus(report)[source]
call_and_report(item: Item, when: Literal[‘setup’, ‘call’, ‘teardown’], log: bool = True, **kwds)[source]
check_interactive_exception(call, report)[source]
call_runtest_hook(item: Item, when: _RuntestPhase, ihook=None, **kwds)[source]
class CallInfo(result, excinfo: Optional[_pytest._code.code.ExceptionInfo], start, stop, when='Literal["setup", "call", "teardown"]')[source]

Bases: object

Result/Exception info a function invocation.

when

context of invocation

result
classmethod from_call(func, when)_pytest.runner.CallInfo[source]
pytest_runtest_makereport(item, call)[source]
pytest_make_collect_report(collector: _pytest.nodes.Collector)_pytest.reports.CollectReport[source]
class SetupState[source]

Bases: object

shared state for setting up/tearing down test items or collectors.

addfinalizer(finalizer, colitem)[source]

attach a finalizer to the given colitem.

_pop_and_teardown()[source]
_callfinalizers(colitem)[source]
_teardown_with_finalization(colitem)[source]
teardown_all()[source]
teardown_exact(item, nextitem)[source]
_teardown_towards(needed_collectors)[source]
prepare(colitem)[source]

setup objects along the collector chain to the test-method and teardown previously setup objects.

collect_one_node(collector)[source]