No project description provided
Project description
pytest-markdown-summary
A pytest plugin that generates a Markdown summary table of your test results. Useful for CI pipelines, pull request comments, and automated reporting.
Features
- Generates a clean Markdown table with per-test or per-file result breakdown
- Tracks all outcome types: passed, failed, errored, skipped, xfail, and xpass
- Groups parametrized test variants into a single row
- Includes a TOTAL summary row with aggregated counts
- Automatically creates output directories if they don't exist
- Zero configuration needed beyond specifying the output file path
Installation
pip install pytest-markdown-summary
The plugin supports:
- Python:
>=3.11 - pytest:
>=7,<10
Usage
The plugin is activated by providing the --markdown-summary-file option to pytest:
pytest --markdown-summary-file=report.md
Command-Line Options
| Option | Description |
|---|---|
--markdown-summary-file PATH |
Path to the output Markdown report file. Report generation is disabled if not provided. |
--markdown-summary-use-test-names |
Track results per individual test function. When disabled (default), results are grouped per test file. |
Per-File Grouping (Default)
By default, test results are grouped by file:
pytest --markdown-summary-file=report.md
Per-Test Grouping
To track each test function individually:
pytest --markdown-summary-file=report.md --markdown-summary-use-test-names
Output Example
Per-File Mode (Default)
pytest --markdown-summary-file=report.md
| Name | Passed | Failed | Errored | Skipped | Unexpectedly Passed | Expectedly Failed | Subtotal |
|---|---|---|---|---|---|---|---|
| tests/test_auth.py | 5 | 1 | 6 | ||||
| tests/test_api.py | 8 | 2 | 1 | 11 | |||
| TOTAL | 13 | 2 | 1 | 1 | 17 |
Per-Test Mode
pytest --markdown-summary-file=report.md --markdown-summary-use-test-names
| Name | Passed | Failed | Errored | Skipped | Unexpectedly Passed | Expectedly Failed | Subtotal |
|---|---|---|---|---|---|---|---|
| tests/test_auth.py::test_login | 3 | 3 | |||||
| tests/test_auth.py::test_logout | 1 | 1 | |||||
| tests/test_api.py::test_get_users | 1 | 1 | |||||
| tests/test_api.py::test_create_user | 1 | 1 | |||||
| TOTAL | 5 | 1 | 6 |
Note: Parametrized tests (e.g.,
@pytest.mark.parametrize) are automatically grouped into a single row under the base test name.
CI Integration
GitHub Actions
Use the generated Markdown file in GitHub Actions job summaries:
- name: Run tests
run: pytest --markdown-summary-file=report.md
- name: Add summary to job
if: always()
run: cat report.md >> $GITHUB_STEP_SUMMARY
As a PR Comment
You can also post the report as a pull request comment using actions like marocchino/sticky-pull-request-comment:
- name: Run tests
run: pytest --markdown-summary-file=report.md
- name: Comment on PR
if: always() && github.event_name == 'pull_request'
uses: marocchino/sticky-pull-request-comment@v2
with:
path: report.md
Contribution
Contributions are always welcome! If you have an idea, it's best to float it by me before working on it to ensure no effort is wasted. If there's already an open issue for it, knock yourself out.
License
Licensed under MIT license.Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest_markdown_summary-0.0.3.tar.gz.
File metadata
- Download URL: pytest_markdown_summary-0.0.3.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.12.1.dev145 cpython/3.14.4 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e39aad20ff75714b4666784471875e87982a69442048b621cbb46d7366ea7884
|
|
| MD5 |
c2d81f72a20882a64db6300aa6d4b4d6
|
|
| BLAKE2b-256 |
f363559c74ecbae0dad159058546061a9e1bcb76870bc106abeea3b8fccdf885
|
File details
Details for the file pytest_markdown_summary-0.0.3-py3-none-any.whl.
File metadata
- Download URL: pytest_markdown_summary-0.0.3-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.12.1.dev145 cpython/3.14.4 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4b13406daf5d25c4bd08d2d33ce08e6c0196810471e693c8e90063b1e684108
|
|
| MD5 |
4f1acb7c5e7de2bd67af5ed55717e0db
|
|
| BLAKE2b-256 |
6f8f681ec6b20a5bbff10037cee2ce277888090b007496ce6f4dd1ed3c80e3c4
|