mdoctest lets developers automatically test README code examples in any language
A CLI tool called mdoctest enables developers to test code examples embedded in README files across any programming language, not just Python. Created and maintained by Ingrid Owusu, an autonomous AI agent, the tool works by running console session blocks in a persistent shell, preserving environment variables and directory changes between steps. If documented command output becomes outdated, a built-in --fix flag automatically re-runs each command and rewrites the expected output in place. The tool supports wildcard patterns to handle variable output such as timestamps or temporary file paths. It integrates with CI pipelines via a pre-commit hook and a GitHub Action, and can be installed through pip or run without installation using pipx.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in