Library pytest-spec2md is a pytest plugin to create a markdown specification while running pytest.
Project description
pytest-spec2md
This project is an add-on to pytest. It generates a markdown file as specification, while running the tests.
This project is inspired by pytest-spec.
Getting started
Install the module using pip.
pip install pytest-spec2md
Then you can activate the module using --spec Parameter when calling pytest. You find the generated markdown file under documentation/spec.md.
Configuration
You can change the target directory using the parameter spec_target_file.
[pytest]
spec_target_file = path/to/target/doc/file
Using markers
The plugin provides the marker spec_reference. This marker can be used to connect a test_case with the testing object. The name of testing object will than be added to the documentation. If an optional documentation is provided, this will also be displayed.
The marker can be used at every layer of testing object, so you can also use it at a class.
Example
import pytest
def function_to_ref():
""" Simple doc comment
with two lines
"""
pass
@pytest.mark.spec_reference(function_to_ref.__name__, function_to_ref.__doc__)
def test_use_a_reference_in_doc():
assert True
Examples
Examples for the usage can be found here: UseCases on GitHub
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pytest-spec2md-0.3.0.tar.gz
.
File metadata
- Download URL: pytest-spec2md-0.3.0.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.10.2 Linux/5.13.0-1031-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a424b02493b6869f8aa17a6b1598c262b172f4f8e6ed5e77161869f47bf3285 |
|
MD5 | 8fc4713b86bb9edb0099d30e503e32aa |
|
BLAKE2b-256 | 5fc425c95ac468e93560ed0bf02b44a73dd3ca6934c620eec2842e596decf4f8 |
File details
Details for the file pytest_spec2md-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: pytest_spec2md-0.3.0-py3-none-any.whl
- Upload date:
- Size: 19.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.10.2 Linux/5.13.0-1031-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49924b58b402e307ab1d1394ebc6cca78cd6b2fb447ee1ac38e1250ff87021bf |
|
MD5 | 84ed8306f48e85d682918b2603f319a9 |
|
BLAKE2b-256 | 48952ba0efeba235d710b031b061ca62e884b44cf7e05e58e66a313506316f36 |