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.1.tar.gz
(7.0 kB
view hashes)
Built Distribution
Close
Hashes for markdown_pytest-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78299acbadcc00e9dd5d47c0384e6258b9dd7bdd91a00a5cac204b273b77156d |
|
MD5 | 5cdeaec4e99c60abc36f6647f9b7b008 |
|
BLAKE2b-256 | 179466a79c81e1eb67542ff6b85b580ac517927be864381403ce6d7e4e3aa337 |