Skip to content

The hooks other scenarios never reach

Assertion comparison, deselection, string conditions and the debugger.

A plain test run reaches about three quarters of pytest's hooks. The rest need provoking: an assertion that compares rather than merely fails, a deselected test, a skipif written as a string, the assertion-pass hook switched on, and a debugger session.

This scenario provokes all of them in one run, which is why it observes more hooks than any other. pytest.ini enables enable_assertion_pass_hook, and autopdb.py supplies a Pdb that continues the moment it is entered - so the debugger hooks fire without the run hanging.

Three hooks remain out of reach even here. pytest_cmdline_parse runs before any plugin exists to watch it. pytest_report_to_serializable and pytest_report_from_serializable are never called by pytest itself - they belong to plugins that ship reports between processes, such as xdist.

Latest pytest - or pick a flow below.

Distinct flows

52 captured releases produce 8 distinct flows.

Flow Releases
pytest 8.1.1 - 9.1.1 20
pytest 8.0.0 - 8.0.2 3
pytest 7.3.2 - 7.4.4 6
pytest 7.1.0 - 7.3.1 9
pytest 7.0.0 - 7.0.1 2
pytest 6.2.0 - 6.2.5 6
pytest 6.1.0 - 6.1.2 3
pytest 6.0.0 - 6.0.2 3