doctest.DocFileSuite()
¶
-
doctest.
DocFileSuite
(*paths, **kw)[source]¶ A unittest suite for one or more doctest files.
The path to each doctest file is given as a string; the interpretation of that string depends on the keyword argument “module_relative”.
A number of options may be provided as keyword arguments:
- module_relative
If “module_relative” is True, then the given file paths are interpreted as os-independent module-relative paths. By default, these paths are relative to the calling module’s directory; but if the “package” argument is specified, then they are relative to that package. To ensure os-independence, “filename” should use “/” characters to separate path segments, and may not be an absolute path (i.e., it may not begin with “/”).
If “module_relative” is False, then the given file paths are interpreted as os-specific paths. These paths may be absolute or relative (to the current working directory).
- package
- A Python package or the name of a Python package whose directory should be used as the base directory for module relative paths. If “package” is not specified, then the calling module’s directory is used as the base directory for module relative filenames. It is an error to specify “package” if “module_relative” is False.
- setUp
- A set-up function. This is called before running the tests in each file. The setUp function will be passed a DocTest object. The setUp function can access the test globals as the globs attribute of the test passed.
- tearDown
- A tear-down function. This is called after running the tests in each file. The tearDown function will be passed a DocTest object. The tearDown function can access the test globals as the globs attribute of the test passed.
- globs
- A dictionary containing initial global variables for the tests.
- optionflags
- A set of doctest option flags expressed as an integer.
- parser
- A DocTestParser (or subclass) that should be used to extract tests from the files.
- encoding
- An encoding that will be used to convert the files to unicode.