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 p
(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)
| 2002 | return TestResults(runner.failures, runner.tries) |
| 2003 | |
| 2004 | def testfile(filename, module_relative=True, name=None, package=None, |
| 2005 | globs=None, verbose=None, report=True, optionflags=0, |
| 2006 | extraglobs=None, raise_on_error=False, parser=DocTestParser(), |
| 2007 | encoding=None): |
| 2008 | """ |
| 2009 | Test examples in the given file. Return (#failures, #tests). |
| 2010 | |
| 2011 | Optional keyword arg "module_relative" specifies how filenames |
| 2012 | should be interpreted: |
| 2013 | |
| 2014 | - If "module_relative" is True (the default), then "filename" |
| 2015 | specifies a module-relative path. By default, this path is |
| 2016 | relative to the calling module's directory; but if the |
| 2017 | "package" argument is specified, then it is relative to that |
| 2018 | package. To ensure os-independence, "filename" should use |
| 2019 | "/" characters to separate path segments, and should not |
| 2020 | be an absolute path (i.e., it may not begin with "/"). |
| 2021 | |
| 2022 | - If "module_relative" is False, then "filename" specifies an |
| 2023 | os-specific path. The path may be absolute or relative (to |
| 2024 | the current working directory). |
| 2025 | |
| 2026 | Optional keyword arg "name" gives the name of the test; by default |
| 2027 | use the file's basename. |
| 2028 | |
| 2029 | Optional keyword argument "package" is a Python package or the |
| 2030 | name of a Python package whose directory should be used as the |
| 2031 | base directory for a module relative filename. If no package is |
| 2032 | specified, then the calling module's directory is used as the base |
| 2033 | directory for module relative filenames. It is an error to |
| 2034 | specify "package" if "module_relative" is False. |
| 2035 | |
| 2036 | Optional keyword arg "globs" gives a dict to be used as the globals |
| 2037 | when executing examples; by default, use {}. A copy of this dict |
| 2038 | is actually used for each docstring, so that each docstring's |
| 2039 | examples start with a clean slate. |
| 2040 | |
| 2041 | Optional keyword arg "extraglobs" gives a dictionary that should be |
| 2042 | merged into the globals that are used to execute examples. By |
| 2043 | default, no extra globals are used. |
| 2044 | |
| 2045 | Optional keyword arg "verbose" prints lots of stuff if true, prints |
| 2046 | only failures if false; by default, it's true iff "-v" is in sys.argv. |
| 2047 | |
| 2048 | Optional keyword arg "report" prints a summary at the end when true, |
| 2049 | else prints nothing at the end. In verbose mode, the summary is |
| 2050 | detailed, else very brief (in fact, empty if all tests passed). |
| 2051 | |
| 2052 | Optional keyword arg "optionflags" or's together module constants, |
| 2053 | and defaults to 0. Possible values (see the docs for details): |
| 2054 | |
| 2055 | DONT_ACCEPT_TRUE_FOR_1 |
| 2056 | DONT_ACCEPT_BLANKLINE |
| 2057 | NORMALIZE_WHITESPACE |
| 2058 | ELLIPSIS |
| 2059 | SKIP |
| 2060 | IGNORE_EXCEPTION_DETAIL |
| 2061 | REPORT_UDIFF |
no test coverage detected