Skip to main content

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 tests
  • x = xfailed tests
  • X = xpassed tests (shown by default)
  • p = passed tests
  • P = passed tests with output
  • w = warnings
  • a = all except passes
  • A = all including passes
  • N = 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_markdown_report-0.2.0.tar.gz (187.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_markdown_report-0.2.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file pytest_markdown_report-0.2.0.tar.gz.

File metadata

  • Download URL: pytest_markdown_report-0.2.0.tar.gz
  • Upload date:
  • Size: 187.9 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for pytest_markdown_report-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e376f3c388989a443a16a98810878a2c1bb11cd160c3cc1297e565c724b61435
MD5 d7ef67170b0838b5dcfed9300599545e
BLAKE2b-256 83aa35a252d5452258237b382fee0ada5b21297cfe40b95b5efc70e7c3920f96

See more details on using hashes here.

File details

Details for the file pytest_markdown_report-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_markdown_report-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for pytest_markdown_report-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 240e18a0d8b7702e97869d88c70ac03aab9e062cde78e94a2f802d0b4069390a
MD5 5728df2dbe8dff48ed38c036fe4b8386
BLAKE2b-256 c5f9043769c4d09dc8f9edde805dddb639219b8a05a5167a0d8df5d8e5eb9cf3

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.1

2 files

0.1.0

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page