exdown is deprecated. Use pytest-codeblocks instead.
exdown
This is exdown, a tool for extracting code blocks from Markdown files and to create tests from them.
Install with
pip install exdown
and create tests for pytest with
import exdown
test_readme = exdown.pytests_from_file("README.md")
The test_readme variable is really a decorated function that pytest will pick up and
turn into tests.
tests/test_readme.py ............. [100%]
Skipping code blocks
If you don't want all code blocks to be extracted, you can filter by syntax
exdown.pytests_from_file("README.md", syntax_filter="python")
or prefix your code block in the Markdown file with an exdown-skip comment
Lorem ipsum
<!--exdown-skip-->
```python
foo + bar # not working
```
dolor sit amet.
Merging code blocks
Broken-up code blocks can be merged into one with the exdown-cont prefix
Lorem ipsum
```
a = 1
```
dolor sit amet
<!--exdown-cont-->
```
# this would otherwise fail since `a` is not defined
a + 1
```
Expected output
You can also define the expected output of a code block:
This
```
print(1 + 3)
```
gives
<!--exdown-expected-output-->
```
5
```
Expected errors
Some code blocks are expected to give errors. You can verify this with
The following gives an error:
<!--exdown-expect-exception-->
```python
1 / 0
```
License
This software is published under the MIT license.
Metadata
Release files for exdown 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| exdown-0.9.0.zip | 13.2 kB | Without provenance | Details for exdown-0.9.0.zip |
Release files / exdown-0.9.0.zip
| Download URL | exdown-0.9.0.zip |
|---|---|
| Size | 13.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8837ed0fe12963516c45d352e7f4f81e15503ffaa18a155a0a30696e02e603c
|
|
BLAKE2b-256 checksum How to use checksums |
f5691a8383e92fd022b285096a464d3bd5af8c3f1ba249cf651313a401bd1aef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10
|
Security for exdown 0.9.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.