Axm audit report plugin
axm_audit_report_plugin
Tiny pytest plugin that writes audit_test's structured result as JSON.
It is loaded by name (-p axm_audit_report_plugin) into the target's
pytest, whose interpreter does not have axm-audit installed and must not need
any third-party reporting plugin: this module imports nothing but the standard
library and pytest, and uses only long-stable hooks (pytest 7.0 and later).
The destination comes from --axm-report-file=PATH; without it the plugin is
inert. The JSON keeps the shape the runner has always consumed (the one
pytest-json-report produced), restricted to what the runner reads:
summary: count per test outcome,totalandcollected(deselectedwhen some were);tests: per nodenodeid,lineno,outcomeand one entry per executed phase (setup/call/teardown) withduration,outcome,crash(path,lineno,message) andlongrepr, the failure text bounded to head and tail;collectors: the collectors that failed, with their boundedlongrepr;duration,root,exitcode,pytest_versionandschema.
pytest_addoption(parser)
Declare the report destination option.
Source code in packages/axm-audit/src/axm_audit/_report_plugin/axm_audit_report_plugin.py
| Python | |
|---|---|
pytest_collectreport(report)
Record a collector that failed (syntax or import error in a test file).
Source code in packages/axm-audit/src/axm_audit/_report_plugin/axm_audit_report_plugin.py
pytest_deselected(items)
pytest_runtest_logreport(report)
Record one phase of a test and fold it into the test's outcome.
Source code in packages/axm-audit/src/axm_audit/_report_plugin/axm_audit_report_plugin.py
pytest_sessionfinish(session, exitstatus)
Write the structured result to the requested file.
Source code in packages/axm-audit/src/axm_audit/_report_plugin/axm_audit_report_plugin.py
pytest_sessionstart(session)
Reset the recorded state for the session.