A simple module to test your documentation examples with pytest
Project description
markdown-pytest
A simple module to test your documentation examples with pytest.
Markdown:
```python
assert True
```
Will be shown as:
assert True
You can use the special value __name__
to check to separate the run example
and the test code.
Markdown:
```python
if __name__ == '__main__':
exit(0)
if __name__ == 'markdown-pytest':
assert True
```
Will be shown as:
if __name__ == '__main__':
exit(0)
if __name__ == 'markdown-pytest':
assert True
Code after the # noqa
comment will not be executed.
```python
# noqa
from universe import antigravity, WrongPlanet
try:
antigravity()
except WrongPlanet:
print("You are on the wrong planet.")
exit(1)
```
Will be shown as:
# noqa
from universe import antigravity, WrongPlanet
try:
antigravity()
except WrongPlanet:
print("You are on the wrong planet.")
exit(1)
This README.md file might be tested like this:
$ poetry run pytest -sxv README.md 17:20:29 master
=============== test session starts ===============
plugins: md-0.1.0
collected 3 items
README.md::line[16-17] PASSED
README.md::line[36-40] PASSED
README.md::line[60-68] PASSED
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
markdown_pytest-0.1.0.tar.gz
(2.6 kB
view details)
Built Distribution
File details
Details for the file markdown_pytest-0.1.0.tar.gz
.
File metadata
- Download URL: markdown_pytest-0.1.0.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.11.0 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a351b4cdaf467d426edd0d371a3801f16904459f2c2b11a87fe20eb46099848 |
|
MD5 | c17c50e25498f8fbea19130afa359ff0 |
|
BLAKE2b-256 | 470af10992310b57ab6b7c98591da1d525093ed1abd8047ae8ff2e4dda820b1c |
File details
Details for the file markdown_pytest-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: markdown_pytest-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.11.0 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 067bf201f5cde4137134172d60fd47f996dc3e1cba51fe37342d6a0cbc64dd07 |
|
MD5 | dbf020bf1967b0d3a4c78eeba8fc74c2 |
|
BLAKE2b-256 | c5eb5c338fff0d35171f886b06148f19d155b2f17cb56ee0153e3e0b73893d66 |