Pytest Plugin

The Asqav SDK ships a pytest plugin that signs each test result during a run and writes a Merkle-rooted compliance bundle at the end. One flag, no conftest.py changes, one artifact ready for an auditor.

Install

bash
pip install asqav

The plugin auto-registers via the SDK's pytest entry point. No extras flag needed.

Run

bash
# Sign every test outcome and emit a bundle on session finish
ASQAV_API_KEY=sk_live_... pytest --asqav

# Custom output path, agent name, and framework
pytest --asqav \
  --asqav-agent ci-runner \
  --asqav-output out/compliance.json \
  --asqav-framework eu_ai_act_art12

If ASQAV_API_KEY is not set when --asqav is passed, pytest exits with a usage error rather than half-signing the run.

What it captures

The plugin signs each test outcome via agent.sign("test:result", context={...}) in the call phase. Every passed, failed, and skipped test ends up on the bundle. The signed context for each result carries:

At session finish the plugin calls asqav.compliance.export_bundle(signatures, framework=...) and writes the bundle (with Merkle root) to --asqav-output.

Flags

Programmatic API

If you have a custom test runner that signs results itself, build the same bundle without spinning up pytest:

python
from asqav.pytest_plugin import make_bundle_from_report

bundle = make_bundle_from_report(signatures, framework="soc2")
bundle.to_file("audit-bundle.json")

Notes

Related