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.3.tar.gz
(7.1 kB
view details)
Built Distribution
File details
Details for the file markdown_pytest-0.1.3.tar.gz
.
File metadata
- Download URL: markdown_pytest-0.1.3.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.11.0 Darwin/22.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c08133fed45cdb9c2e1fed344ba8223c5a94aeda3743a1ba643a156f0c48f924 |
|
MD5 | 3e800711ed1e6b5fc3429cf81e9ce524 |
|
BLAKE2b-256 | 1a5b5be68e9e512c8bbb8a1a342c2add6f55617f04c2fe2df5dab7d7b288502d |
File details
Details for the file markdown_pytest-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: markdown_pytest-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.11.0 Darwin/22.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab3b956f7f4609153141f2bbb766ba7cd1f2e87b1aaf348476b902835585e653 |
|
MD5 | d66f197240d377170be2c4dde494a559 |
|
BLAKE2b-256 | 120b5d2031afaa2b2e47451ac98e175c61b83d1c23cebef8a7cd848b8e86fe23 |