pytest-md

0.2.0 · active · verified Wed Apr 15

pytest-md is a pytest plugin designed for generating Markdown reports from pytest test results. It is currently at version 0.2.0 and receives updates with a moderate release cadence, indicating active maintenance.

Warnings

Install

Imports

Quickstart

After installing `pytest-md`, create some pytest tests. To generate a Markdown report, simply run pytest from your terminal with the `--md` flag, specifying the desired output file name. The report will be generated in the specified file.

# tests/test_example.py
import pytest
import random

def test_passed():
    assert True

def test_failed():
    assert False

@pytest.mark.skip(reason="demonstrating skip")
def test_skipped():
    assert True

@pytest.mark.xfail(reason="demonstrating xfail")
def test_xfail():
    assert False

@pytest.mark.xfail(reason="demonstrating xpass", strict=True)
def test_xpass():
    assert 0.0 < random.random() < 1.0 # This test will actually pass, but is marked xfail.

def test_error_division_by_zero():
    1 / 0

# To generate a Markdown report, run pytest from your terminal:
# pytest --md report.md

view raw JSON →