Skip to main content

pytest-testdox

PyPI Continuous Integration Status codecov

A TestDox format reporter for pytest.

Install

pip install pytest-testdox

Usage

Add the parameter --testdox when running pytest. For example:

pytest --testdox your-tests/

Tip: If you don't want to type --testdox every time you run pytest, add it to addopts in your ini file. For example:

# content of pytest.ini or tox.ini
[pytest]
addopts = --testdox

# or if you use setup.cfg
[tool:pytest]
addopts = --testdox

When using --testdox, the plugin will disable itself when not running on a terminal. If you want the testdox report no matter what, use the parameter --force-testdox instead.

Markers

@pytest.mark.describe

Override the class name in the testdox report. For example:

# test_demo.py
@pytest.mark.describe('create_file')
class TestCreateFile():

    def test_creates_a_file_in_the_so(self):
        pass

Will produce the output:

test_demo.py

create_file
 [x] creates a file in the so

@pytest.mark.it

Override the test title in the testdox report. For example:

# test_demo.py
class TestCreateFile():

    @pytest.mark.it('Creates a local file in the SO')
    def test_creates_a_file_in_the_so(self):
        pass

Will produce the output:

test_demo.py

Create File
 [x] Creates a local file in the SO

Configuration file options

testdox_format

Specifies TestDox report format, plaintext or utf8 (default: utf8). For example:

# content of pytest.ini
# (or tox.ini or setup.cfg)
[pytest]
testdox_format = plaintext
$ pytest test_demo.py
============================= test session starts ==============================
platform darwin -- Python 3.5.0, pytest-3.0.7, py-1.4.33, pluggy-0.4.0
rootdir: /private/tmp/demo, inifile: pytest.ini
plugins: testdox-dev
collected 2 items

test_demo.py
Pytest Testdox
 [x] prints a BDD style output to your tests
 [x] lets you focus on the behavior

Release files for pytest-testdox 3.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-testdox 3.1.0
File Size Uploaded
pytest-testdox-3.1.0.tar.gz 8.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-testdox 3.1.0
File Interpreter ABI Platform
pytest_testdox-3.1.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 18.0 kB

Release files / pytest-testdox-3.1.0.tar.gz

Download URL pytest-testdox-3.1.0.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f48c49c517f0fb926560b383062db4961112078ec6ca555f91692c661bb5c765
BLAKE2b-256 checksum
How to use checksums
6432d833d70c7b30994c593d721001ab218f02baee4f6d5be322e9ba3f7f77c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release files / pytest_testdox-3.1.0-py2.py3-none-any.whl

Download URL pytest_testdox-3.1.0-py2.py3-none-any.whl
Size 9.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
f3a8f0789d668ccfb60f15aab81fb927b75066cfd19209176166bd7cecae73e6
BLAKE2b-256 checksum
How to use checksums
948c515ff4ab03b744b00f1283455ff189537082a16f62aa5ace6171f4cb5aea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release history Release notifications | RSS feed

This release

3.1.0 This release

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page