{"repo":"mosquito/markdown-pytest","free":true,"listed":false,"github":"https://github.com/mosquito/markdown-pytest","clone":"git clone https://github.com/mosquito/markdown-pytest.git","description":"A simple module to test your documentation examples with pytest","language":"Python","stars":15,"topics":["async","asyncio","doctests","markdown","plugin","pytest","subtests"],"license":"Apache-2.0","category":"productivity","readme_excerpt":"markdown-pytest =============== A pytest plugin that collects and executes Python code blocks from Markdown files, so your documentation examples are always tested. By the way: this README is itself tested by markdown-pytest . Every Python code block below is a real test that runs on every CI build. The HTML comments that mark tests (like ) are invisible in the rendered view — view the raw Markdown source to see them. Quick start ----------- Install with pip: pip install markdown-pytest Or with asyncio support: pip install markdown-pytest[async] Place an HTML comment with a name key directly above a python code fence. The plugin collects it as a test. In your .md file write this: When rendered, the HTML comment becomes invisible — readers see only a clean code block: Run it: $ pytest -v README.md That is the only requirement. Everything below is optional and lets you handle progressively more complex scenarios. Code split ---------- You can split a test across several code blocks by giving them the same name . The blocks are combined into a single test, preserving source line numbers for accurate tracebacks. In the raw Markdown it looks like this: Some explanatory prose in between... Here is a live example. This block performs import: chain usage example: The split blocks do not need to be consecutive. Blocks with the same name are combined even when separated by other tests. In the example below, test non consecutive a is defined in two blocks with a completely unrelated tes","default_branch":null,"files":null,"tree":[],"storefront":"/r/mosquito","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/mosquito/markdown-pytest/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}