(path, module_relative=True, package=None,
globs=None, parser=DocTestParser(),
encoding=None, **options)
| 2542 | ) |
| 2543 | |
| 2544 | def DocFileTest(path, module_relative=True, package=None, |
| 2545 | globs=None, parser=DocTestParser(), |
| 2546 | encoding=None, **options): |
| 2547 | if globs is None: |
| 2548 | globs = {} |
| 2549 | else: |
| 2550 | globs = globs.copy() |
| 2551 | |
| 2552 | if package and not module_relative: |
| 2553 | raise ValueError("Package may only be specified for module-" |
| 2554 | "relative paths.") |
| 2555 | |
| 2556 | # Relativize the path. |
| 2557 | doc, path = _load_testfile(path, package, module_relative, |
| 2558 | encoding or "utf-8") |
| 2559 | |
| 2560 | if "__file__" not in globs: |
| 2561 | globs["__file__"] = path |
| 2562 | |
| 2563 | # Find the file and read it. |
| 2564 | name = os.path.basename(path) |
| 2565 | |
| 2566 | # Convert it to a test, and wrap it in a DocFileCase. |
| 2567 | test = parser.get_doctest(doc, globs, name, path, 0) |
| 2568 | return DocFileCase(test, **options) |
| 2569 | |
| 2570 | def DocFileSuite(*paths, **kw): |
| 2571 | """A unittest suite for one or more doctest files. |
no test coverage detected