Skip to main content

A Pytest plugin for generating reports in Markdown format.

Project description

pytest-markdown-summary

CI PyPI - Version PyPI - Python Version PyPI - Downloads

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.4.tar.gz (8.2 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.4-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file pytest_markdown_summary-0.0.4.tar.gz.

File metadata

  • Download URL: pytest_markdown_summary-0.0.4.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pytest_markdown_summary-0.0.4.tar.gz
Algorithm Hash digest
SHA256 664deea16815093c2314238ff1c7f0a24689f7f53cae4f95e1a0e905741b1213
MD5 b437d4f9d07d79df4cc91a72dff22a81
BLAKE2b-256 635e83af999aeefcca314dab8f498bdae5aba6795f875a4e3d34fbc37a1fdb2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_markdown_summary-0.0.4.tar.gz:

Publisher: publish.yml on vpetrigo/pytest-markdown-summary

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for pytest_markdown_summary-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3c400a5953d86e5f6575911538abc839b162ffc1690c99dd82a01b528b065e6b
MD5 3becb1c4ea77b747e8254951ae03fbf0
BLAKE2b-256 f3e3f3eb47cc6be68bb6cc903f01d0238d36aebcaf83af693e5ca1512e5fc9b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_markdown_summary-0.0.4-py3-none-any.whl:

Publisher: publish.yml on vpetrigo/pytest-markdown-summary

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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