pytest-markdown-report
Token-efficient markdown test reports for LLM-based TDD agents. Replaces pytest's default console output with markdown-formatted results.
Installation
Add to the development dependencies of your project.
pip install pytest-markdown-report
uv add --dev pytest-markdown-report
poetry add --group dev pytest
Usage
Once installed, the plugin automatically replaces pytest's console output with markdown format:
# Markdown output to console (default behavior)
pytest
# Also save to file
pytest --markdown-report=report.md
Verbosity Modes
Default: Summary + failures
pytest
Verbose (-v): Add passed test list
pytest -v
Quiet (-q): Summary + rerun suggestion only
pytest -q
Controlling Output Sections
Use -r flags to show/hide specific sections in default mode:
# Show skipped tests
pytest -rs
# Show expected failures (xfail)
pytest -rx
# Show passed tests
pytest -rp
# Show all except passes
pytest -ra
# Show everything
pytest -rA
# Suppress all sections (summary only)
pytest -rN
Available flags:
f= failed tests (shown by default)E= errors (shown by default)s= skipped testsx= xfailed testsX= xpassed tests (shown by default)p= passed testsP= passed tests with outputw= warningsa= all except passesA= all including passesN= none (suppress sections)
Note: Verbose mode (-v) shows all sections regardless of -r flags.
Options
Save to file:
pytest --markdown-report=report.md
Custom rerun command:
pytest --markdown-rerun-cmd="just test --lf"
Disable rerun suggestion:
pytest --markdown-rerun-cmd=""
Output Format
Default Mode
# Test Report
**Summary:** 2/7 passed, 3 failed, 1 error, 1 skipped
## Errors
### test_database.py::test_with_db ERROR in setup
```python
conftest.py:15: in db_connection
raise ConnectionError("Database unavailable")
E ConnectionError: Database unavailable
```
## Failures
### test_validation.py::test_invalid_input[empty] FAILED
```python
test_validation.py:42: in test_invalid_input
assert validate(input) == expected
E AssertionError: assert False == True
```
Verbose Mode (-v)
Adds passed test list after failures:
## Passes
- test_feature.py::test_critical_path
- test_basic.py::test_simple
Quiet Mode (-q)
**Summary:** 2/5 passed, 3 failed
**Re-run failed:** `pytest --lf`
Design Goals
- Token efficiency: ~40% reduction vs verbose markdown
- Agent-friendly: Full tracebacks with assertion introspection
- TDD workflow: Minimal noise during green phase, detailed failures for debugging
- Configurable: Adapt rerun commands to your workflow (
just, custom recipes)
Edge Cases
Parametrized tests: Parameter values shown in test name [empty]
Skipped tests: Labeled SKIPPED with skip reason in separate section
Expected failures: XFAIL label for expected failures, XPASS for unexpected passes
Setup/teardown failures: Phase notation shows context (e.g., FAILED in setup, FAILED in teardown)
Captured output: Included under failures when present
Integration
The plugin automatically formats all pytest output as markdown. Use with role-specific agents:
# Implementation agent sees failures only (console)
pytest
# Review agent sees all passes (console + file)
pytest -v --markdown-report=review.md --markdown-rerun-cmd="just role-review"
# Minimal output for CI/CD pipelines
pytest -q
Note: Use pytest --durations=N separately for performance analysis (this will also
be in markdown format).
License
MIT
Metadata
Release files for pytest-markdown-report 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest_markdown_report-0.2.0.tar.gz | 187.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_markdown_report-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 197.6 kB
Release files / pytest_markdown_report-0.2.0.tar.gz
| Download URL | pytest_markdown_report-0.2.0.tar.gz |
|---|---|
| Size | 187.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e376f3c388989a443a16a98810878a2c1bb11cd160c3cc1297e565c724b61435
|
|
BLAKE2b-256 checksum How to use checksums |
83aa35a252d5452258237b382fee0ada5b21297cfe40b95b5efc70e7c3920f96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / pytest_markdown_report-0.2.0-py3-none-any.whl
| Download URL | pytest_markdown_report-0.2.0-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
240e18a0d8b7702e97869d88c70ac03aab9e062cde78e94a2f802d0b4069390a
|
|
BLAKE2b-256 checksum How to use checksums |
c5f9043769c4d09dc8f9edde805dddb639219b8a05a5167a0d8df5d8e5eb9cf3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|