Skip to main content

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - Version


Overview

swarmauri_tests_readme_examples is a pytest plugin that turns Markdown code blocks into executable tests. It scans README (or other documentation) files for Python examples and verifies that every runnable block still executes successfully. This keeps documentation trustworthy without hand-maintained test_readme_example.py scaffolding.

The plugin works out of the box for Python code blocks (```python, ```py, ```pycon) and exposes command-line flags and pyproject.toml settings so you can fine-tune which files and languages are exercised.

Installation

pip install swarmauri_tests_readme_examples

pytest discovers the plugin automatically after installation.

Quick Start

Run pytest as usual to execute every Python code block in README.md:

pytest

Sample failure output:

E   README.md::block-3 raised ValueError('boom')

Configuration

You can control the scan through CLI options or pyproject.toml:

  • --readme-files – comma/newline separated Markdown files (default: README.md)
  • --readme-languages – languages to execute (default: python, py, pycon)
  • --readme-mode – parameterized (default) or aggregate
  • --readme-skip-markers – comment markers that skip a block when they appear on the first non-empty line

pyproject.toml example (under [tool.pytest.ini_options]):

[tool.pytest.ini_options]
readme_files = """
    README.md
    docs/guide.md
"""
readme_languages = """
    python
    py
"""
readme_mode = "aggregate"
readme_skip_markers = """
    # pytest: skip-example
    # docs: skip
"""

Skipping Blocks

Place one of the configured skip markers on the first non-empty line to leave a code block out of execution:

```python
# pytest: skip-example
print("shown in docs, ignored in tests")
```

Aggregate Mode

Switch to --readme-mode=aggregate (or set readme_mode = "aggregate") to collapse all README checks into a single pytest item that aggregates every failure message. This is handy when you want a brief summary rather than many individual tests.

License

Licensed under the Apache 2.0 License.

Metadata

Release files for swarmauri_tests_readme_examples 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for swarmauri_tests_readme_examples 0.1.2
File Size Uploaded
swarmauri_tests_readme_examples-0.1.2.tar.gz 9.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for swarmauri_tests_readme_examples 0.1.2
File Interpreter ABI Platform
swarmauri_tests_readme_examples-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 19.6 kB

Release files / swarmauri_tests_readme_examples-0.1.2.tar.gz

Download URL swarmauri_tests_readme_examples-0.1.2.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8294758c84b63a8c578fc11c31f9ee96c0fbc169991ad618d91fd94f3fc53266
BLAKE2b-256 checksum
How to use checksums
a93e2dd86650599f8c9a9dd75ce885ea87af344b138916290323a055cedf3518
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / swarmauri_tests_readme_examples-0.1.2-py3-none-any.whl

Download URL swarmauri_tests_readme_examples-0.1.2-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
296a117b9637849ed17698e16f9f34dd137785e93c69c9f9162868f8fb37d5b8
BLAKE2b-256 checksum
How to use checksums
c7c7851ee3454d9d51192c48ccd9c7d1f335abb102b3ccf635425472a37fa83b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page