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
Test File 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
Test File Test 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.1.0.tar.gz (12.0 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.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytest_markdown_summary-0.1.0.tar.gz
  • Upload date:
  • Size: 12.0 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.1.0.tar.gz
Algorithm Hash digest
SHA256 9be6da61170f0e184bf8f858a61eafe4a33ffac5b368ffd6ed19bc491a36ceb3
MD5 f875a741928697d9232e6939d6d466a1
BLAKE2b-256 14953972c26206045fc68bfa51b331c453ed12dc4bbf7f09b506334fb4b85e80

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_markdown_summary-0.1.0.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.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_markdown_summary-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c33a2ef1dd7b4a6ba9fd4257e10522b98f454053cb973d3b9e7d9ac8c7a59e7
MD5 3bb0bf79c7d4ed4412192f8c01c3c3f9
BLAKE2b-256 3c41f72be7f982dd3816593ce2f5dd19507d4deab482b13f9a3dd81280dffe61

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_markdown_summary-0.1.0-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