Skip to main content

No project description provided

Project description

pytest-markdown-summary

PyPI - Version PyPI - Python Version

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


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_summary-0.0.3.tar.gz (8.1 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_summary-0.0.3-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

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

Hashes for pytest_markdown_summary-0.0.3.tar.gz
Algorithm Hash digest
SHA256 e39aad20ff75714b4666784471875e87982a69442048b621cbb46d7366ea7884
MD5 c2d81f72a20882a64db6300aa6d4b4d6
BLAKE2b-256 f363559c74ecbae0dad159058546061a9e1bcb76870bc106abeea3b8fccdf885

See more details on using hashes here.

File details

Details for the file pytest_markdown_summary-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_markdown_summary-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e4b13406daf5d25c4bd08d2d33ce08e6c0196810471e693c8e90063b1e684108
MD5 4f1acb7c5e7de2bd67af5ed55717e0db
BLAKE2b-256 6f8f681ec6b20a5bbff10037cee2ce277888090b007496ce6f4dd1ed3c80e3c4

See more details on using hashes here.

Supported by

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