---
name: "xdoctest"
section: "1"
platform: "linux"
package: "xdoctest"
version: "1.2.0-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/xdoctest"
---

# xdoctest(1)

Rewrite of Python's builtin doctest module with AST instead of REGEX

## NAME

**xdoctest** - Rewrite of Python's builtin doctest module with AST instead of REGEX

## SYNOPSIS

```
 xdoctest  [-h] [--version] [-m MODNAME] [-c COMMAND] [--style {auto,google,freeform}] [--analysis {auto,static,dynamic}]
          [--durations DURATIONS] [--time] [--colored COLORED] [--nocolor] [--offset]
          [--report {none,cdiff,ndiff,udiff,only_first_failure}] [--options OPTIONS] [--global-exec GLOBAL_EXEC]
          [--supress-import-errors] [--verbose VERBOSE] [--quiet] [--silent]
          [arg ...]
```

## DESCRIPTION

**The \`\`xdoctest\`\` package is a re-write of Python's builtin \`\`doctest\`\`** **module. It replaces the old regex-based parser with a new** **abstract-syntax-tree based parser (using Python's \`\`ast\`\` module). The** **goal is to make doctests easier to write, simpler to configure, and** **encourage the pattern of test driven development.**

## OPTIONS

- **-h, --help**

  **show this help message and exit**

- **--version**

  **Display version info and quit (default: False)** **-m** *MODNAME***, --modname** *MODNAME* **Module name or path. If specified positional modules are ignored (default: None)** **-c** *COMMAND***, --command** *COMMAND* **A doctest name or a command (all\|list\|dump\|\<callname\>). Defaults to \`all\` (which runs everything). Using** **\`list\` will collect and print all doctests. Using \`dump\` will convert doctests into unit tests. Anything** **else will be interpreted as a "callname" (default: None)** **--style {auto,google,freeform}** **Choose the style of doctests that will be parsed (default: auto)** **--analysis {auto,static,dynamic}** **How doctests are collected (default: auto)** **--durations** *DURATIONS* **Specify execution times for slowest N tests.N=0 will show times for all tests (default: None)**

- **--time**

  **Same as if durations=0 (default: False)**

- **--colored *COLORED***

  **Enable or disable ANSI coloration in stdout (default: True)**

- **--nocolor**

  **Disable ANSI coloration in stdout**

- **--offset**

  **If True formatted source linenumbers will agree with their location in the source file. Otherwise they will** **be relative to the doctest itself. (default: False)** **--report {none,cdiff,ndiff,udiff,only\_first\_failure}** **Choose another output format for diffs on xdoctest failure (default: udiff)**

- **--options *OPTIONS***

  **Default directive flags for doctests (default: None)** **--global-exec** *GLOBAL\_EXEC* **Custom Python code to execute before every test (default: None)** **--supress-import-errors** **Removes tracebacks from errors in implicit imports (default: False)**

- **--verbose *VERBOSE***

  **Verbosity level. 0 is silent, 1 prints out test names, 2 additionally prints test stdout, 3 additionally** **prints test source (default: 3)**

- **--quiet**

  **sets verbosity to 1**

- **--silent**

  **sets verbosity to 0**

## REPORTING BUGS

**To report a bug please visit riscemu issues tracking system at:** **https://github.com/Erotemic/xdoctest/issues**

## AUTHORS

**This manual page was written by Bo YU \<tsu.yubo@gmail.com\> for the Debian project** **(but may be used by others).**
