Loader: Doctests¶
Load tests from doctests.
This plugin implements handleFile()
to load doctests from text files
and python modules.
To disable loading doctests from text files, configure an empty extensions list:
[doctest]
extensions =
Enable this Plugin¶
This plugin is built-in, but not loaded by default.
Even if you specify always-on = True
in the configuration, it will not run unless you also enable it. You can do so by putting the following in a unittest.cfg
or nose2.cfg
file
[unittest]
plugins = nose2.plugins.doctests
The plugins
parameter may contain a list of plugin names, including nose2.plugins.doctests
Configuration [doctest]¶
- always-on¶
- Default
False
- Type
boolean
- extensions¶
- Default
[‘.txt’, ‘.rst’]
- Type
list
Sample configuration¶
The default configuration is equivalent to including the following in a unittest.cfg
file.
[doctest]
always-on = False
extensions = .txt
.rst
Command-line options¶
- --with-doctest DEFAULT¶
Load doctests from text files and modules