MCPcopy Index your code
hub / github.com/RustPython/RustPython / testfile

Function testfile

Lib/doctest.py:2091–2212  ·  view source on GitHub ↗

Test examples in the given file. Return (#failures, #tests). Optional keyword arg "module_relative" specifies how filenames should be interpreted: - If "module_relative" is True (the default), then "filename" specifies a module-relative path. By default, this path is

(filename, module_relative=True, name=None, package=None,
             globs=None, verbose=None, report=True, optionflags=0,
             extraglobs=None, raise_on_error=False, parser=DocTestParser(),
             encoding=None)

Source from the content-addressed store, hash-verified

2089
2090
2091def testfile(filename, module_relative=True, name=None, package=None,
2092 globs=None, verbose=None, report=True, optionflags=0,
2093 extraglobs=None, raise_on_error=False, parser=DocTestParser(),
2094 encoding=None):
2095 """
2096 Test examples in the given file. Return (#failures, #tests).
2097
2098 Optional keyword arg "module_relative" specifies how filenames
2099 should be interpreted:
2100
2101 - If "module_relative" is True (the default), then "filename"
2102 specifies a module-relative path. By default, this path is
2103 relative to the calling module's directory; but if the
2104 "package" argument is specified, then it is relative to that
2105 package. To ensure os-independence, "filename" should use
2106 "/" characters to separate path segments, and should not
2107 be an absolute path (i.e., it may not begin with "/").
2108
2109 - If "module_relative" is False, then "filename" specifies an
2110 os-specific path. The path may be absolute or relative (to
2111 the current working directory).
2112
2113 Optional keyword arg "name" gives the name of the test; by default
2114 use the file's basename.
2115
2116 Optional keyword argument "package" is a Python package or the
2117 name of a Python package whose directory should be used as the
2118 base directory for a module relative filename. If no package is
2119 specified, then the calling module's directory is used as the base
2120 directory for module relative filenames. It is an error to
2121 specify "package" if "module_relative" is False.
2122
2123 Optional keyword arg "globs" gives a dict to be used as the globals
2124 when executing examples; by default, use {}. A copy of this dict
2125 is actually used for each docstring, so that each docstring's
2126 examples start with a clean slate.
2127
2128 Optional keyword arg "extraglobs" gives a dictionary that should be
2129 merged into the globals that are used to execute examples. By
2130 default, no extra globals are used.
2131
2132 Optional keyword arg "verbose" prints lots of stuff if true, prints
2133 only failures if false; by default, it's true iff "-v" is in sys.argv.
2134
2135 Optional keyword arg "report" prints a summary at the end when true,
2136 else prints nothing at the end. In verbose mode, the summary is
2137 detailed, else very brief (in fact, empty if all tests passed).
2138
2139 Optional keyword arg "optionflags" or's together module constants,
2140 and defaults to 0. Possible values (see the docs for details):
2141
2142 DONT_ACCEPT_TRUE_FOR_1
2143 DONT_ACCEPT_BLANKLINE
2144 NORMALIZE_WHITESPACE
2145 ELLIPSIS
2146 SKIP
2147 IGNORE_EXCEPTION_DETAIL
2148 REPORT_UDIFF

Callers 1

_testFunction · 0.85

Calls 12

runMethod · 0.95
summarizeMethod · 0.95
DocTestParserClass · 0.85
_load_testfileFunction · 0.85
DebugRunnerClass · 0.85
DocTestRunnerClass · 0.85
basenameMethod · 0.80
get_doctestMethod · 0.80
TestResultsClass · 0.70
copyMethod · 0.45
updateMethod · 0.45
mergeMethod · 0.45

Tested by

no test coverage detected