Skip to content

Latest commit

 

History

History
71 lines (53 loc) · 2.09 KB

README.rst

File metadata and controls

71 lines (53 loc) · 2.09 KB

Welcome to pytest-docs!

pytest-docs allows you to annotate your tests and generate documentation about your tests. pytest testing tool.

See the pytest documentation for more information on pytest itself.

Quickstart

Add apporpriate includes and annotates to your test files:

import json
import pytestdoc

def times(x, y):
    return x * y

TEST_CATEGORY="derp"

@pytestdoc.tattr_redmine_feature(7474)
@pytestdoc.tattr_redmine_bug(7475, 1776)
@pytestdoc.tattr_incomplete
@pytestdoc.tattr_category("herp")
@pytestdoc.tattr_doc("""
This is the *documentation* for my function

It tests the following things:

- if derps are herps
- all fives are half of 10

""")
def test_positive():
    assert times(5,5) == 25

@pytestdoc.tattr_doc("""Test that this works when first item is negative""")
@pytestdoc.tattr_category("herp:negatives")
def test_firstnegative():
    assert times(-2,5) == -10

@pytestdoc.tattr_doc("""Test that this works when second item is negative""")
@pytestdoc.tattr_category("herp:negatives")
def test_secondnegative():
    assert times(3,-12) == -36

@pytestdoc.tattr_doc("""Test that this works when both items are negative""")
@pytestdoc.tattr_category("herp:negatives")
def test_bothnegative():
    assert times(-12,-12) == 144