NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #3948 most downloaded on PyPI
A rewrite of the builtin doctest module
Last release 6 months ago
27 Mar 2026
Release timing varies
gaps range from 2 weeks to 13 months
Most releases are documented
notes for 53 of the last 60 stable releases
1 version withdrawn
withdrawn after publishing
9 years old
76 releases · first in 2017
Correctly find line numbers for decorated async def functions (without crashing).
async def functions (without crashing).Full Changelog: https://github.com/Erotemic/xdoctest/compare/v1.3.1...refs/heads/release
Static discovery now includes doctests defined in async def functions.
async def functions.Full Changelog: https://github.com/Erotemic/xdoctest/compare/v1.3.0...refs/heads/release
One column per quarter.
Removed deprecated --xdoc-force-dynamic and --allow-xdoc-dynamic flags
ASYNC basic directive to hold the asyncio event loop in any section of
code. Useful for multitasking tests.16806_WORKAROUND as it is not longer needed for Python 3.8+_pytest.doctest via the plugin system by @TTsangSC in https://github.com/Erotemic/xdoctest/pull/174asyncio.Runner on Python>=3.11 by @x42005e1f in https://github.com/Erotemic/xdoctest/pull/178Full Changelog: https://github.com/Erotemic/xdoctest/compare/v1.2.0...refs/heads/release
Support for top level awaits in async code examples.
Full Changelog: https://github.com/Erotemic/xdoctest/compare/v1.1.6...refs/heads/release
Fix python3.13 deprecation warning by @sdb9696 in https://github.com/Erotemic/xdoctest/pull/157
flags as keyword argument to re.sub for python 3.13 compliance.Full Changelog: https://github.com/Erotemic/xdoctest/compare/v1.1.5...refs/heads/release
This patch release fixes the modname_to_modpath issue that 1.1.4 mitigated. It should be once again be possible to invoke xdoctest using module names
This patch release fixes the modname_to_modpath issue that 1.1.4 mitigated. It should be once again be possible to invoke xdoctest using module names of packages that installed in editable mode (a feature that was broken whenever type annotations were added into the editable finder files installed to site-packages).
xdoctest --version-info and exposed it in CLI help.modname_to_modpath fixed in cases where editable installs use type annotations in their MAPPING definition.Full Changelog: https://github.com/Erotemic/xdoctest/compare/v1.1.4...refs/heads/release
Working around a modname_to_modpath issue.
modname_to_modpath issue.Full Changelog: https://github.com/Erotemic/xdoctest/compare/v1.1.3...refs/heads/release
Fixed deprecated usage of ast.Num
modname_to_modpath now handles cases where editable packages have modules where the name is different than the package.xdoctest.plugin to support pytest 8.0ast.NumFull Changelog: https://github.com/Erotemic/xdoctest/compare/v1.1.2...v1.1.3
Partial support for 3.12. New f-string syntax is not supported yet.
Binary tests are now only run on "full" installs to reduce minimal dependencies.
Can now handle basic versions of the new __editable__ package finder mechanism.
__editable__ package finder mechanism.Environs as options: XDOCTEST_VERBOSE, XDOCTEST_OPTIONS, XDOCTEST_GLOBAL_EXEC, XDOCTEST_REPORT, XDOCTEST_STYLE, and XDOCTEST_ANALYSIS environment vari
XDOCTEST_VERBOSE, XDOCTEST_OPTIONS, XDOCTEST_GLOBAL_EXEC, XDOCTEST_REPORT,
XDOCTEST_STYLE, and XDOCTEST_ANALYSIS environment variables can now be used
to specify configuration defaults.--insert-skip-directive-above-failures
that can be used to modify your code such that failing doctests are marked as
skip.Added util_deprecation module to robustly mark features as deprecated.
tool.xdoctest. Currently only
supports options in the native runner.global_state and allowed
environs to enable debug print statements.util_deprecation module to robustly mark features as deprecated.*args and **kwargs in
args blocks. This has also moved to the standalone package googledocThere is nothing too special functionality-wise about this 1.0 release, except that xdoctest has been in a 1.0 state for a long time. It is now widely
There is nothing too special functionality-wise about this 1.0 release, except that xdoctest has been in a 1.0 state for a long time. It is now widely used, and it deserves to be marked as the mature and stable library that it is.
The xdoctest "analysis" option now defaults to "auto" everywhere.
--analysis=dynamic argument is now respectedDisabled workaround 16806 in Python 3.8+
Removed the distracting and very long internal traceback that occurred in pytest when a module errors while it is being imported before the doctest is
--xdoctest-verbose=2 by default (note this does
nothing unless -s is also given so pytest does not supress output)Yanked - contained debug print statements
Yanked - contained debug print statements
python_implementation argumentsDirective syntax errors are now handled as doctest runtime errors and return better debugging information.
Better message when a pytest skip or exit-test-exception occurs
FixtureRequestMinor issues with release tarballs.
Moved to CircleCI deploy scripts
Bug where references to doctest variables were never released
pip install xdoctest can now specify [colors] or [jupyter]
pip install xdoctest can now specify [colors] or [jupyter]doctest_callable where it would not populate globals from the function context.Config to DoctestConfigstatic_analysis.parse_calldefs to static_analysis.parse_static_calldefs.
A temporary function with the old name is exposed for backwards compatibility.modpath_or_name to module_identifier in several functions.
This is to better indicate its coercible nature as either a module path, a
module name. This change impacts doctest_module, parse_doctestables,
package_calldefs.The REQUIRES directive can now inspect existence or values of environment variables.
doctest_callable function, which executes the doctests of a
function or class.NO_COLOR environment variable.IPython.embed and ipdb.launch_ipdb_on_exception now correctly work from
inside doctests.pytest-matrix. See #82xdoctest.runner.doctest_module now accepts the module object itself.
xdoctest.runner.doctest_module now accepts the module object itself.Use from_parent constructors for pytest modules when possible. Fixes deprecation warning.
3.9.0a5 when eval returns a coroutine (tentative).from_parent constructors for pytest modules when possible. Fixes deprecation warning.xdoctest -m xdoctest.__init__ __doc__:0 work like xdoctest -m xdoctest/__init__.py __doc__:0REQUIRES directive now supports CPython, IronPython, Jython, and PyPy
The verbose flag was previously not taken into account. This is now fixed.
The --xdoc-glob list of patterns now defaults to empty. In general it is not safe to assume a default pattern. This means the user must opt-in to test
--xdoc-glob list of patterns now defaults to empty. In general it is
not safe to assume a default pattern. This means the user must opt-in to
testing text files as if they were doctests.PythonPathContext now works in more corner cases, although some rarer corner cases will now break. This trade-off should be a net positive.
PythonPathContext now works in more corner cases, although some rarer
corner cases will now break. This trade-off should be a net positive.Can now specify zero-args as the command to the xdoctest CLI to run all zero-args functions in a file.
--version option to CLI interface... is a continuation and not
a ellipsis. (i.e. you don't need to write ... #)>>> or ... when possible)run_tests.py now returns the correct error code. (fixes CircleCI)Improved backwards compatibility. Explicit continuations now work more similarly to the original doctest.
... is a continuation and not a ellipsis.Add skip count to the native runner
Renamed several functions in various classes to be private. Its unlikely anyone was externally using them. The change functions include:
DoctestExample: pre_run -> _pre_runDoctestExample: post_run -> _post_runDirective: unpack_args -> _unpack_argsDirective: state_item -> effectModified behavior of RuntimeState.update to use the directive effect.
Added explicit REQUIRES runtime-state, which maintains a set of unmet conditions. When non-empty it behaves like SKIP.
The native runner now exits with a non-zero error code on failure
Slight modifications to file structure
util_import from ubelt### Fixed * Minor fixes to readme and docs
Got-want exceptions now return a special error if it fails to create a string-representation of the object instead of crashing.
index argument in import_module_from_path is now correctly used.The REQUIRES directive can now accept python modules in the form: # xdoctest: +REQUIRES(module: )
# xdoctest: +REQUIRES(module:<my_modname>)Example::.Removed warning if pygments is not installed
pygments is not installed### Changed * Changed verbosity defaults
Added global-exec to native xdoctest CLI and xdoctest-global-exec to the pytest plugin CLI
global-exec to native xdoctest CLI and xdoctest-global-exec to the pytest plugin CLIDocTest.globs to DocTest.global_namespacetraceback parsing that sometimes caused incorrectly offset line numbers.Fixed bug in static_analysis.is_balanced_statement and static_analysis.extract_comments having to do with empty lines
static_analysis.is_balanced_statement and
static_analysis.extract_comments having to do with empty linesimport_module_from_path seemed to modify sys.path in a specific environmentFixed python2 unicode error in collection phase
Better error messages when you forget a raw string on a google block with newlines in the docstr.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Added config option for lineno offsets. (corresponding arguments added to native and pytest runners)
Generally Improved doctest error reporting
DoctestExample.run from the traceback!(we report line numbers of errors in a more intuitive way).
doclineno_end was incorrectly parsedAdded auto parsing style. This first tries to use Google, but falls back on freeform if no google-style doctests are found.
Nothing published for this version
Changed development status to Beta
BLANKLINE marker if enabledThe reported difference between got and want now preserves newlines for better visibility.
Fixed bug where pytest would collect all tests twice (because the __init__.py file was normalized to a directory in package_modpaths)
__init__.py file was normalized to a directory in package_modpaths)API update to facilitate mkinit
mkinitImproved doctest syntax error message
PythonPathContext no longer breaks if small changes to the path occur in its context.PythonPathContext can now insert into front or back of sys.pathYour coding agent can read these notes before it upgrades. Set up the MCP server →