bpo-40275: Use new test.support helper submodules in tests (GH-21448)
diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py
index 8d9f872..bff20f9 100644
--- a/Lib/test/test_doctest.py
+++ b/Lib/test/test_doctest.py
@@ -3,6 +3,8 @@
"""
from test import support
+from test.support import import_helper
+from test.support import os_helper
import doctest
import functools
import os
@@ -441,7 +443,7 @@
>>> tests = finder.find(sample_func)
>>> print(tests) # doctest: +ELLIPSIS
- [<DocTest sample_func from ...:25 (1 example)>]
+ [<DocTest sample_func from ...:27 (1 example)>]
The exact name depends on how test_doctest was invoked, so allow for
leading path components.
@@ -705,7 +707,7 @@
try:
mod = importlib.import_module(pkg_name)
finally:
- support.forget(pkg_name)
+ import_helper.forget(pkg_name)
sys.path.pop()
include_empty_finder = doctest.DocTestFinder(exclude_empty=False)
@@ -2758,7 +2760,7 @@
>>> dn = tempfile.mkdtemp()
>>> pkg = os.path.join(dn, "doctest_testpkg")
>>> os.mkdir(pkg)
- >>> support.create_empty_file(os.path.join(pkg, "__init__.py"))
+ >>> os_helper.create_empty_file(os.path.join(pkg, "__init__.py"))
>>> fn = os.path.join(pkg, "doctest_testfile.txt")
>>> with open(fn, 'wb') as f:
... f.write(
@@ -2840,7 +2842,8 @@
simple tests and no errors. We'll run both the unadorned doctest command, and
the verbose version, and then check the output:
- >>> from test.support import script_helper, temp_dir
+ >>> from test.support import script_helper
+ >>> from test.support.os_helper import temp_dir
>>> with temp_dir() as tmpdir:
... fn = os.path.join(tmpdir, 'myfile.doc')
... with open(fn, 'w') as f:
@@ -2891,7 +2894,8 @@
file ends in '.py', its handling of python module files (as opposed to straight
text files).
- >>> from test.support import script_helper, temp_dir
+ >>> from test.support import script_helper
+ >>> from test.support.os_helper import temp_dir
>>> with temp_dir() as tmpdir:
... fn = os.path.join(tmpdir, 'myfile.doc')
... with open(fn, 'w') as f:
@@ -3109,7 +3113,7 @@
def test_coverage(coverdir):
- trace = support.import_module('trace')
+ trace = import_helper.import_module('trace')
tracer = trace.Trace(ignoredirs=[sys.base_prefix, sys.base_exec_prefix,],
trace=0, count=1)
tracer.run('test_main()')