Coder Social home page Coder Social logo

pytest-markdown's Introduction

pytest-markdown

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.

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.

Join the pytest-md community! ๐ŸŒ๐ŸŒ๐ŸŒŽ

License

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

pytest-markdown's People

Contributors

hackebrot avatar keu avatar seanson avatar ssd71 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.