Pytest Integration (Current Status)
The stable khaos-agent release in this repository does notship a first-class pytest plugin or pytest fixtures.
Recommended Workflow
Keep Khaos tests as @khaostest functions and run them withkhaos test. Use pytest for your non-Khaos unit/integration suites.
Terminal
# Khaos agent tests
khaos test
khaos test tests/test_security.py --format junit -o khaos-results.xml
# Your existing pytest suite
pytest tests/unit -vCI Example (Both Runners)
.github/workflows/tests.yml
name: Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
pip install khaos-agent
pip install -r requirements-dev.txt
- name: Run Khaos tests
run: khaos test --format junit -o khaos-test-results.xml
- name: Run pytest suite
run: pytest tests/unit -v --junitxml=pytest-results.xmlWhat Works Today
@khaostestdecoratorkhaos testdiscovery and executionkhaos testoutput formats: text/json/junit/markdown/all- Imperative tests via injected
AgentTestClient
Not Available in Stable SDK
Not Implemented in This Repo's Stable Surface
The following pytest-specific features are not currently shipped: auto-registered pytest plugin, pytest markers for Khaos tests,
khaos_faults fixture,khaos_snapshot fixture, and pytest CLI flags like--khaos-timeout.Related Docs
- Testing Framework — core
@khaostestusage - CLI Reference —
khaos testcommand options - CI/CD — complete pipeline examples