Skip to main content

Plugin for generating Markdown reports for pytest results

Project description

pytest-md

Plugin for generating Markdown reports for pytest results 📝

Installation

pytest-md is available on PyPI for Python versions 3.6 and newer and can be installed into your enviroment from your terminal via pip:

$ pip install pytest-md

Usage

The following example code produces all of the different pytest test outcomes.

import random
import pytest


def test_failed():
    assert "emoji" == "hello world"


@pytest.mark.xfail
def test_xfailed():
    assert random.random() == 1.0


@pytest.mark.xfail
def test_xpassed():
    assert 0.0 < random.random() < 1.0


@pytest.mark.skip(reason="don't run this test")
def test_skipped():
    assert "pytest-emoji" != ""


@pytest.mark.parametrize(
    "name, expected",
    [
        ("Sara", "Hello Sara!"),
        ("Mat", "Hello Mat!"),
        ("Annie", "Hello Annie!"),
    ],
)
def test_passed(name, expected):
    assert f"Hello {name}!" == expected


@pytest.fixture
def number():
    return 1234 / 0


def test_error(number):
    assert number == number

With pytest-md installed, you can now generate a Markdown test report as follows:

$ pytest --md report.md
# Test Report

*Report generated on 25-Feb-2019 at 17:18:29 by [pytest-md]*

[pytest-md]: https://github.com/hackebrot/pytest-md

## Summary

8 tests ran in 0.05 seconds

- 1 failed
- 3 passed
- 1 skipped
- 1 xfailed
- 1 xpassed
- 1 error

pytest-emoji

pytest-md also integrates with pytest-emoji, which allows us to include emojis in the generated Markdown test report:

$ pytest --emoji -v --md report.md
# Test Report

*Report generated on 25-Feb-2019 at 17:18:29 by [pytest-md]* 📝

[pytest-md]: https://github.com/hackebrot/pytest-md

## Summary

8 tests ran in 0.06 seconds ⏱

- 1 failed 😰
- 3 passed 😃
- 1 skipped 🙄
- 1 xfailed 😞
- 1 xpassed 😲
- 1 error 😡

Credits

This project is inspired by the fantastic pytest-html plugin! 💻

Community

Would you like to contribute to pytest-md? You're awesome! 😃

Please check out the good first issue label for tasks, that are good candidates for your first contribution to pytest-md. Your contributions are greatly appreciated! Every little bit helps, and credit will always be given! Find out who has already contributed to pytest-md here! 🌍🌏🌎

Please note that pytest-md is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

License

Distributed under the terms of the MIT license, pytest-md is free and open source software.

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-md-0.2.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

pytest_md-0.2.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file pytest-md-0.2.0.tar.gz.

File metadata

  • Download URL: pytest-md-0.2.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.1

File hashes

Hashes for pytest-md-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3b248d5b360ea5198e05b4f49c7442234812809a63137ec6cdd3643a40cf0112
MD5 98f164541200185558757a879458129e
BLAKE2b-256 0e551d4248f08a97255abb23b05d8ba07586333194fadb17beda96b707aebecd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytest_md-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.1

File hashes

Hashes for pytest_md-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c4cd16fea6d1485e87ee254558712c804a96d2aa9674b780e7eb8fb6526e1d1
MD5 ef792d8148ae1660492c8ed53fdb340e
BLAKE2b-256 807123d03f57c18116c6770141478e33b3500c4e92500cf4b49a396e9226733f

See more details on using hashes here.

Supported by

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