2333 |
2334 |
2335 |
2336 |
2337 |
2338 |
2339 |
2340 |
2341 |
2342 |
2343 |
2344 |
2345 |
2346 |
2347 |
2348 |
2349 |
2350 |
2351 |
2352 |
2353 | |
def DocFileTest(path, module_relative=True, package=None, |
globs=None, parser=DocTestParser(), **options): |
if globs is None: |
globs = {} |
|
if package and not module_relative: |
raise ValueError("Package may only be specified for module-" |
"relative paths.") |
|
|
if module_relative: |
package = _normalize_module(package) |
path = _module_relative_path(package, path) |
|
|
name = os.path.basename(path) |
doc = open(path).read() |
|
|
test = parser.get_doctest(doc, globs, name, path, 0) |
return DocFileCase(test, **options) | |