$npx skillfedfor your agent

pytest-codeblocks

Test code blocks in your READMEs

Worth itPyPI TestingReleased Jun 2026186.4K downloads / mopermissive licensePure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — pytest_codeblocks-0.18.0-py3-none-any.whl
v0.18.0 · released 2026-06-15 · Python >=3.10 · 1 runtime deps: pytest

Yes. Low install friction, no security vulnerabilities, permissive MIT license, and active maintenance make this a straightforward addition to any project with documentation that includes runnable code. It solves a real problem—keeping examples in sync with code—with minimal overhead.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.10 or later.
  • Low friction install with a single runtime dependency on pytest.
  • Actively maintained with a release within the last 60 days and marked as Production/Stable.

License · maintenance · safety

permissive license (permissive) — MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.

last release 2026-06-15 (60 days)

0 known vulnerabilities (OSV.dev, 2026-08-14) · 186,361 downloads/mo, #9,989 on PyPI

Verify before relying

pip install pytest-codeblocks

# In your README.md, add code blocks with python or sh syntax highlighting
# Then run:
pytest --codeblocks
  • Whether the plugin handles edge cases like nested code blocks or complex markdown structures.
  • Performance characteristics when testing large numbers of code blocks across many files.
Same gist for agents: .md · .json

What it is and what it does

pytest-codeblocks is a pytest plugin that treats code blocks in markdown files—particularly READMEs—as executable test cases. It discovers blocks marked with python, sh, bash, or zsh syntax highlighting and runs them through pytest, letting you verify that documentation examples actually work.

The plugin supports marking code blocks with pytest directives (skip, skipif, xfail) via HTML comments, merging fragmented examples across multiple blocks, and validating expected output. This catches a common documentation debt: examples that drift out of sync with the actual codebase. It depends only on pytest and requires Python 3.10 or later.

Use it for

  • Verify that code examples in a project's README actually execute without errors.
  • Catch breaking changes when refactoring by running documented usage patterns as tests.
  • Validate shell command sequences and their output in installation or setup documentation.
  • Ensure multi-step code examples work when split across separate markdown blocks.
  • Skip or mark code blocks as expected-to-fail for examples that demonstrate error handling.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

Low install friction, no security vulnerabilities, permissive MIT license, and active maintenance make this a straightforward addition to any project with documentation that includes runnable code. It solves a real problem—keeping examples in sync with code—with minimal overhead.

Install

pytest-codeblocks on PyPI

Before you install

Low friction install with a single runtime dependency on pytest. Actively maintained with a release within the last 60 days and marked as Production/Stable.

Requires Python 3.10 or later.

License in practice

MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.

Quickstart

pip install pytest-codeblocks

# In your README.md, add code blocks with python or sh syntax highlighting
# Then run:
pytest --codeblocks

Verify before relying

  • Whether the plugin handles edge cases like nested code blocks or complex markdown structures.
  • Performance characteristics when testing large numbers of code blocks across many files.

Package facts

Licensepermissive license permissive
Python supportSupports the current Python release >=3.10
Install frictionLow. Pure-Python wheel
Runtime dependencies
1 package
pytest
MaintenanceActively maintained 60 days since the last release
First released
Downloads186,361 / month, #9,989 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3

Evidence: pytest_codeblocks-0.18.0-py3-none-any.whl

Tags

Capabilities
test code blocks in markdownreadme code example testingpytest markdown pluginvalidate documentation codeshell script testing in docspython snippet verification
Topics
documentation-testingmarkdown-validation

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “test code blocks in markdown”

  • pytest-codeblocksA pytest plugin that automatically discovers and runs Python and…
  • pytest-markdown-docsA pytest plugin that executes Python code snippets embedded in…
  • doccmdRuns linters, formatters, and other command-line tools against code…

Give your agent the search over MCP, or paste the wish link into any chat.

More Testing packages

pluggy Worth it
PyPI · Libraries · released May 2025

Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.

Install it if you're building an extensible application or framework.

MITpure Python · 3.9+aging
1.3Bdownloads / mo
pytest Worth it
PyPI · Libraries · released Jun 2026

pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.

MITpure Python · 3.10+
1.1Bdownloads / mo
virtualenv Worth it
PyPI · Libraries · released Aug 2026

virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.

MITpure Python · 3.9+
532.9Mdownloads / mo
coverage Worth it
PyPI · Testing · released Aug 2026

Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.

Install it if you want to measure test completeness or enforce coverage thresholds in your project.

permissive licensepure Python · 3.10+
335.8Mdownloads / mo
pytest-asyncio Worth it
PyPI · Testing · released May 2026

pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.

Install it if you write tests for any asyncio-based code.

Apache-2.0pure Python · 3.10+
275.9Mdownloads / mo
pytest-json-ctrf Worth it
PyPI · Testing · released Jul 2026

A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.

Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.

MITpure Python · 3.8+
273.0Mdownloads / mo

See also pytest-markdown-docs · pytest_tagging · pytest-md · pytest-doctestplus · pytest-examples · pytest-skip-slow · pytest-describe · pytest-dependency · markdown-callouts · pytest-skip-markers