(path, module_relative=True, package=None,
globs=None, parser=DocTestParser(),
encoding=None, **options)
| 2618 | ) |
| 2619 | |
| 2620 | def DocFileTest(path, module_relative=True, package=None, |
| 2621 | globs=None, parser=DocTestParser(), |
| 2622 | encoding=None, **options): |
| 2623 | if globs is None: |
| 2624 | globs = {} |
| 2625 | else: |
| 2626 | globs = globs.copy() |
| 2627 | |
| 2628 | if package and not module_relative: |
| 2629 | raise ValueError("Package may only be specified for module-" |
| 2630 | "relative paths.") |
| 2631 | |
| 2632 | # Relativize the path. |
| 2633 | doc, path = _load_testfile(path, package, module_relative, |
| 2634 | encoding or "utf-8") |
| 2635 | |
| 2636 | if "__file__" not in globs: |
| 2637 | globs["__file__"] = path |
| 2638 | |
| 2639 | # Find the file and read it. |
| 2640 | name = os.path.basename(path) |
| 2641 | |
| 2642 | # Convert it to a test, and wrap it in a DocFileCase. |
| 2643 | test = parser.get_doctest(doc, globs, name, path, 0) |
| 2644 | return DocFileCase(test, **options) |
| 2645 | |
| 2646 | def DocFileSuite(*paths, **kw): |
| 2647 | """A unittest suite for one or more doctest files. |
no test coverage detected
searching dependent graphs…