summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHai Shi <shihai1992@gmail.com>2020-08-07 15:18:38 (GMT)
committerGitHub <noreply@github.com>2020-08-07 15:18:38 (GMT)
commit598a951844122678de2596dbc1e0e09e2be65fd2 (patch)
tree23e7f7765fd015e838382e443f39269a2745fbc4
parent46e19b61d31ba99f049258efa4ff1334856a3643 (diff)
downloadcpython-598a951844122678de2596dbc1e0e09e2be65fd2.zip
cpython-598a951844122678de2596dbc1e0e09e2be65fd2.tar.gz
cpython-598a951844122678de2596dbc1e0e09e2be65fd2.tar.bz2
bpo-40275: Use new test.support helper submodules in tests (GH-21764)
-rw-r--r--Lib/ctypes/test/test_loading.py3
-rw-r--r--Lib/sqlite3/test/hooks.py3
-rw-r--r--Lib/test/_test_multiprocessing.py32
-rw-r--r--Lib/test/test___all__.py5
-rw-r--r--Lib/test/test_asyncio/test_proactor_events.py8
-rw-r--r--Lib/test/test_ntpath.py12
-rw-r--r--Lib/test/test_ossaudiodev.py3
-rw-r--r--Lib/test/test_platform.py2
-rw-r--r--Lib/test/test_posixpath.py92
-rw-r--r--Lib/test/test_py_compile.py2
-rw-r--r--Lib/test/test_source_encoding.py4
-rw-r--r--Lib/test/test_startfile.py3
-rw-r--r--Lib/test/test_sundry.py6
-rw-r--r--Lib/test/test_winconsoleio.py4
-rw-r--r--Lib/test/test_zoneinfo/_support.py2
15 files changed, 97 insertions, 84 deletions
diff --git a/Lib/ctypes/test/test_loading.py b/Lib/ctypes/test/test_loading.py
index ba655bc..38b45f9 100644
--- a/Lib/ctypes/test/test_loading.py
+++ b/Lib/ctypes/test/test_loading.py
@@ -5,6 +5,7 @@ import subprocess
import sys
import unittest
import test.support
+from test.support import import_helper
from ctypes.util import find_library
libc_name = None
@@ -117,7 +118,7 @@ class LoaderTest(unittest.TestCase):
@unittest.skipUnless(os.name == "nt",
'test specific to Windows')
def test_load_dll_with_flags(self):
- _sqlite3 = test.support.import_module("_sqlite3")
+ _sqlite3 = import_helper.import_module("_sqlite3")
src = _sqlite3.__file__
if src.lower().endswith("_d.pyd"):
ext = "_d.dll"
diff --git a/Lib/sqlite3/test/hooks.py b/Lib/sqlite3/test/hooks.py
index d74e74b..b08adf1 100644
--- a/Lib/sqlite3/test/hooks.py
+++ b/Lib/sqlite3/test/hooks.py
@@ -24,7 +24,8 @@
import unittest
import sqlite3 as sqlite
-from test.support import TESTFN, unlink
+from test.support.os_helper import TESTFN, unlink
+
class CollationTests(unittest.TestCase):
def CheckCreateCollationNotString(self):
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
index bde102a..58663c0 100644
--- a/Lib/test/_test_multiprocessing.py
+++ b/Lib/test/_test_multiprocessing.py
@@ -28,8 +28,10 @@ import test.support.script_helper
from test import support
from test.support import hashlib_helper
from test.support import import_helper
+from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
+from test.support import warnings_helper
# Skip tests if _multiprocessing wasn't built.
@@ -615,7 +617,7 @@ class _TestProcess(BaseTestCase):
@classmethod
def _test_child_fd_inflation(self, evt, q):
- q.put(test.support.fd_count())
+ q.put(os_helper.fd_count())
evt.wait()
def test_child_fd_inflation(self):
@@ -819,8 +821,8 @@ class _TestSubclassingProcess(BaseTestCase):
if self.TYPE == "threads":
self.skipTest('test not appropriate for {}'.format(self.TYPE))
- testfn = test.support.TESTFN
- self.addCleanup(test.support.unlink, testfn)
+ testfn = os_helper.TESTFN
+ self.addCleanup(os_helper.unlink, testfn)
proc = self.Process(target=self._test_stderr_flush, args=(testfn,))
proc.start()
proc.join()
@@ -849,8 +851,8 @@ class _TestSubclassingProcess(BaseTestCase):
if self.TYPE == 'threads':
self.skipTest('test not appropriate for {}'.format(self.TYPE))
- testfn = test.support.TESTFN
- self.addCleanup(test.support.unlink, testfn)
+ testfn = os_helper.TESTFN
+ self.addCleanup(os_helper.unlink, testfn)
for reason in (
[1, 2, 3],
@@ -1114,7 +1116,7 @@ class _TestQueue(BaseTestCase):
close_queue(queue)
def test_no_import_lock_contention(self):
- with test.support.temp_cwd():
+ with os_helper.temp_cwd():
module_name = 'imported_by_an_imported_module'
with open(module_name + '.py', 'w') as f:
f.write("""if 1:
@@ -1127,7 +1129,7 @@ class _TestQueue(BaseTestCase):
del q
""")
- with test.support.DirsOnSysPath(os.getcwd()):
+ with import_helper.DirsOnSysPath(os.getcwd()):
try:
__import__(module_name)
except pyqueue.Empty:
@@ -2688,8 +2690,8 @@ class _TestPool(BaseTestCase):
# force state to RUN to emit ResourceWarning in __del__()
pool._state = multiprocessing.pool.RUN
- with support.check_warnings(('unclosed running multiprocessing pool',
- ResourceWarning)):
+ with warnings_helper.check_warnings(
+ ('unclosed running multiprocessing pool', ResourceWarning)):
pool = None
support.gc_collect()
@@ -3199,14 +3201,14 @@ class _TestConnection(BaseTestCase):
p = self.Process(target=self._writefd, args=(child_conn, b"foo"))
p.daemon = True
p.start()
- self.addCleanup(test.support.unlink, test.support.TESTFN)
- with open(test.support.TESTFN, "wb") as f:
+ self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+ with open(os_helper.TESTFN, "wb") as f:
fd = f.fileno()
if msvcrt:
fd = msvcrt.get_osfhandle(fd)
reduction.send_handle(conn, fd, p.pid)
p.join()
- with open(test.support.TESTFN, "rb") as f:
+ with open(os_helper.TESTFN, "rb") as f:
self.assertEqual(f.read(), b"foo")
@unittest.skipUnless(HAS_REDUCTION, "test needs multiprocessing.reduction")
@@ -3225,8 +3227,8 @@ class _TestConnection(BaseTestCase):
p = self.Process(target=self._writefd, args=(child_conn, b"bar", True))
p.daemon = True
p.start()
- self.addCleanup(test.support.unlink, test.support.TESTFN)
- with open(test.support.TESTFN, "wb") as f:
+ self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+ with open(os_helper.TESTFN, "wb") as f:
fd = f.fileno()
for newfd in range(256, MAXFD):
if not self._is_fd_assigned(newfd):
@@ -3239,7 +3241,7 @@ class _TestConnection(BaseTestCase):
finally:
os.close(newfd)
p.join()
- with open(test.support.TESTFN, "rb") as f:
+ with open(os_helper.TESTFN, "rb") as f:
self.assertEqual(f.read(), b"bar")
@classmethod
diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py
index 0ba243e..0a03dd2 100644
--- a/Lib/test/test___all__.py
+++ b/Lib/test/test___all__.py
@@ -1,5 +1,6 @@
import unittest
from test import support
+from test.support import warnings_helper
import os
import sys
@@ -15,7 +16,7 @@ class AllTest(unittest.TestCase):
def check_all(self, modname):
names = {}
- with support.check_warnings(
+ with warnings_helper.check_warnings(
(".* (module|package)", DeprecationWarning),
(".* (module|package)", PendingDeprecationWarning),
("", ResourceWarning),
@@ -31,7 +32,7 @@ class AllTest(unittest.TestCase):
raise NoAll(modname)
names = {}
with self.subTest(module=modname):
- with support.check_warnings(
+ with warnings_helper.check_warnings(
("", DeprecationWarning),
("", ResourceWarning),
quiet=True):
diff --git a/Lib/test/test_asyncio/test_proactor_events.py b/Lib/test/test_asyncio/test_proactor_events.py
index 50ba4c1..d0ab387 100644
--- a/Lib/test/test_asyncio/test_proactor_events.py
+++ b/Lib/test/test_asyncio/test_proactor_events.py
@@ -12,7 +12,7 @@ from asyncio.proactor_events import _ProactorSocketTransport
from asyncio.proactor_events import _ProactorWritePipeTransport
from asyncio.proactor_events import _ProactorDuplexPipeTransport
from asyncio.proactor_events import _ProactorDatagramTransport
-from test import support
+from test.support import os_helper
from test.support import socket_helper
from test.test_asyncio import utils as test_utils
@@ -935,20 +935,20 @@ class ProactorEventLoopUnixSockSendfileTests(test_utils.TestCase):
@classmethod
def setUpClass(cls):
- with open(support.TESTFN, 'wb') as fp:
+ with open(os_helper.TESTFN, 'wb') as fp:
fp.write(cls.DATA)
super().setUpClass()
@classmethod
def tearDownClass(cls):
- support.unlink(support.TESTFN)
+ os_helper.unlink(os_helper.TESTFN)
super().tearDownClass()
def setUp(self):
self.loop = asyncio.ProactorEventLoop()
self.set_event_loop(self.loop)
self.addCleanup(self.loop.close)
- self.file = open(support.TESTFN, 'rb')
+ self.file = open(os_helper.TESTFN, 'rb')
self.addCleanup(self.file.close)
super().setUp()
diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py
index 0d84ff8..a8f764f 100644
--- a/Lib/test/test_ntpath.py
+++ b/Lib/test/test_ntpath.py
@@ -6,7 +6,7 @@ import warnings
from test.support import os_helper
from test.support import TestFailed
from test.support.os_helper import FakePath
-from test import support, test_genericpath
+from test import test_genericpath
from tempfile import TemporaryFile
@@ -287,7 +287,7 @@ class TestNtpath(NtpathTestCase):
os.mkdir(ABSTFN)
self.addCleanup(os_helper.rmtree, ABSTFN)
- with support.change_cwd(ABSTFN):
+ with os_helper.change_cwd(ABSTFN):
os.mkdir("subdir")
os.chdir("subdir")
os.symlink(".", "recursive")
@@ -443,11 +443,11 @@ class TestNtpath(NtpathTestCase):
self.assertPathEqual(test_file_long, ntpath.realpath(test_file_short))
- with support.change_cwd(test_dir_long):
+ with os_helper.change_cwd(test_dir_long):
self.assertPathEqual(test_file_long, ntpath.realpath("file.txt"))
- with support.change_cwd(test_dir_long.lower()):
+ with os_helper.change_cwd(test_dir_long.lower()):
self.assertPathEqual(test_file_long, ntpath.realpath("file.txt"))
- with support.change_cwd(test_dir_short):
+ with os_helper.change_cwd(test_dir_short):
self.assertPathEqual(test_file_long, ntpath.realpath("file.txt"))
def test_expandvars(self):
@@ -673,7 +673,7 @@ class TestNtpath(NtpathTestCase):
# locations below cannot then refer to mount points
#
drive, path = ntpath.splitdrive(sys.executable)
- with support.change_cwd(ntpath.dirname(sys.executable)):
+ with os_helper.change_cwd(ntpath.dirname(sys.executable)):
self.assertFalse(ntpath.ismount(drive.lower()))
self.assertFalse(ntpath.ismount(drive.upper()))
diff --git a/Lib/test/test_ossaudiodev.py b/Lib/test/test_ossaudiodev.py
index 624fbf2..d3766e5 100644
--- a/Lib/test/test_ossaudiodev.py
+++ b/Lib/test/test_ossaudiodev.py
@@ -1,9 +1,10 @@
from test import support
+from test.support import import_helper
support.requires('audio')
from test.support import findfile
-ossaudiodev = support.import_module('ossaudiodev')
+ossaudiodev = import_helper.import_module('ossaudiodev')
import errno
import sys
diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py
index 5ad306e..b5d21e5 100644
--- a/Lib/test/test_platform.py
+++ b/Lib/test/test_platform.py
@@ -196,7 +196,7 @@ class PlatformTest(unittest.TestCase):
# using it, per
# http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process-Bitness.aspx
try:
- with support.EnvironmentVarGuard() as environ:
+ with os_helper.EnvironmentVarGuard() as environ:
if 'PROCESSOR_ARCHITEW6432' in environ:
del environ['PROCESSOR_ARCHITEW6432']
environ['PROCESSOR_ARCHITECTURE'] = 'foo'
diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py
index 18819a5..f37e825 100644
--- a/Lib/test/test_posixpath.py
+++ b/Lib/test/test_posixpath.py
@@ -2,7 +2,9 @@ import os
import posixpath
import unittest
from posixpath import realpath, abspath, dirname, basename
-from test import support, test_genericpath
+from test import test_genericpath
+from test.support import import_helper
+from test.support import os_helper
from test.support import FakePath
from unittest import mock
@@ -15,7 +17,7 @@ except ImportError:
# An absolute path to a temporary filename for testing. We can't rely on TESTFN
# being an absolute path, so we need this.
-ABSTFN = abspath(support.TESTFN)
+ABSTFN = abspath(os_helper.TESTFN)
def skip_if_ABSTFN_contains_backslash(test):
"""
@@ -40,8 +42,8 @@ class PosixPathTest(unittest.TestCase):
def tearDown(self):
for suffix in ["", "1", "2"]:
- support.unlink(support.TESTFN + suffix)
- safe_rmdir(support.TESTFN + suffix)
+ os_helper.unlink(os_helper.TESTFN + suffix)
+ safe_rmdir(os_helper.TESTFN + suffix)
def test_join(self):
self.assertEqual(posixpath.join("/foo", "bar", "/bar", "baz"),
@@ -152,25 +154,25 @@ class PosixPathTest(unittest.TestCase):
self.assertEqual(posixpath.dirname(b"//foo//bar"), b"//foo")
def test_islink(self):
- self.assertIs(posixpath.islink(support.TESTFN + "1"), False)
- self.assertIs(posixpath.lexists(support.TESTFN + "2"), False)
+ self.assertIs(posixpath.islink(os_helper.TESTFN + "1"), False)
+ self.assertIs(posixpath.lexists(os_helper.TESTFN + "2"), False)
- with open(support.TESTFN + "1", "wb") as f:
+ with open(os_helper.TESTFN + "1", "wb") as f:
f.write(b"foo")
- self.assertIs(posixpath.islink(support.TESTFN + "1"), False)
+ self.assertIs(posixpath.islink(os_helper.TESTFN + "1"), False)
- if support.can_symlink():
- os.symlink(support.TESTFN + "1", support.TESTFN + "2")
- self.assertIs(posixpath.islink(support.TESTFN + "2"), True)
- os.remove(support.TESTFN + "1")
- self.assertIs(posixpath.islink(support.TESTFN + "2"), True)
- self.assertIs(posixpath.exists(support.TESTFN + "2"), False)
- self.assertIs(posixpath.lexists(support.TESTFN + "2"), True)
+ if os_helper.can_symlink():
+ os.symlink(os_helper.TESTFN + "1", os_helper.TESTFN + "2")
+ self.assertIs(posixpath.islink(os_helper.TESTFN + "2"), True)
+ os.remove(os_helper.TESTFN + "1")
+ self.assertIs(posixpath.islink(os_helper.TESTFN + "2"), True)
+ self.assertIs(posixpath.exists(os_helper.TESTFN + "2"), False)
+ self.assertIs(posixpath.lexists(os_helper.TESTFN + "2"), True)
- self.assertIs(posixpath.islink(support.TESTFN + "\udfff"), False)
- self.assertIs(posixpath.islink(os.fsencode(support.TESTFN) + b"\xff"), False)
- self.assertIs(posixpath.islink(support.TESTFN + "\x00"), False)
- self.assertIs(posixpath.islink(os.fsencode(support.TESTFN) + b"\x00"), False)
+ self.assertIs(posixpath.islink(os_helper.TESTFN + "\udfff"), False)
+ self.assertIs(posixpath.islink(os.fsencode(os_helper.TESTFN) + b"\xff"), False)
+ self.assertIs(posixpath.islink(os_helper.TESTFN + "\x00"), False)
+ self.assertIs(posixpath.islink(os.fsencode(os_helper.TESTFN) + b"\x00"), False)
def test_ismount(self):
self.assertIs(posixpath.ismount("/"), True)
@@ -190,7 +192,7 @@ class PosixPathTest(unittest.TestCase):
self.assertIs(posixpath.ismount('/\x00'), False)
self.assertIs(posixpath.ismount(b'/\x00'), False)
- @unittest.skipUnless(support.can_symlink(),
+ @unittest.skipUnless(os_helper.can_symlink(),
"Test requires symlink support")
def test_ismount_symlinks(self):
# Symlinks are never mountpoints.
@@ -245,7 +247,7 @@ class PosixPathTest(unittest.TestCase):
self.assertEqual(posixpath.expanduser(b"foo"), b"foo")
def test_expanduser_home_envvar(self):
- with support.EnvironmentVarGuard() as env:
+ with os_helper.EnvironmentVarGuard() as env:
env['HOME'] = '/home/victor'
self.assertEqual(posixpath.expanduser("~"), "/home/victor")
@@ -261,7 +263,7 @@ class PosixPathTest(unittest.TestCase):
self.assertEqual(posixpath.expanduser("~/foo"), "/foo")
def test_expanduser_pwd(self):
- pwd = support.import_module('pwd')
+ pwd = import_helper.import_module('pwd')
self.assertIsInstance(posixpath.expanduser("~/"), str)
self.assertIsInstance(posixpath.expanduser(b"~/"), bytes)
@@ -281,7 +283,7 @@ class PosixPathTest(unittest.TestCase):
self.assertIsInstance(posixpath.expanduser(b"~root/"), bytes)
self.assertIsInstance(posixpath.expanduser(b"~foo/"), bytes)
- with support.EnvironmentVarGuard() as env:
+ with os_helper.EnvironmentVarGuard() as env:
# expanduser should fall back to using the password database
del env['HOME']
@@ -348,7 +350,7 @@ class PosixPathTest(unittest.TestCase):
os.symlink(ABSTFN+"1", ABSTFN)
self.assertEqual(realpath(ABSTFN), ABSTFN+"1")
finally:
- support.unlink(ABSTFN)
+ os_helper.unlink(ABSTFN)
@unittest.skipUnless(hasattr(os, "symlink"),
"Missing symlink implementation")
@@ -358,7 +360,7 @@ class PosixPathTest(unittest.TestCase):
os.symlink(posixpath.relpath(ABSTFN+"1"), ABSTFN)
self.assertEqual(realpath(ABSTFN), ABSTFN+"1")
finally:
- support.unlink(ABSTFN)
+ os_helper.unlink(ABSTFN)
@unittest.skipUnless(hasattr(os, "symlink"),
"Missing symlink implementation")
@@ -392,15 +394,15 @@ class PosixPathTest(unittest.TestCase):
self.assertEqual(realpath(ABSTFN+"c"), ABSTFN+"c")
# Test using relative path as well.
- with support.change_cwd(dirname(ABSTFN)):
+ with os_helper.change_cwd(dirname(ABSTFN)):
self.assertEqual(realpath(basename(ABSTFN)), ABSTFN)
finally:
- support.unlink(ABSTFN)
- support.unlink(ABSTFN+"1")
- support.unlink(ABSTFN+"2")
- support.unlink(ABSTFN+"y")
- support.unlink(ABSTFN+"c")
- support.unlink(ABSTFN+"a")
+ os_helper.unlink(ABSTFN)
+ os_helper.unlink(ABSTFN+"1")
+ os_helper.unlink(ABSTFN+"2")
+ os_helper.unlink(ABSTFN+"y")
+ os_helper.unlink(ABSTFN+"c")
+ os_helper.unlink(ABSTFN+"a")
@unittest.skipUnless(hasattr(os, "symlink"),
"Missing symlink implementation")
@@ -413,8 +415,8 @@ class PosixPathTest(unittest.TestCase):
os.symlink('self/self/self', ABSTFN + '/link')
self.assertEqual(realpath(ABSTFN + '/link'), ABSTFN)
finally:
- support.unlink(ABSTFN + '/self')
- support.unlink(ABSTFN + '/link')
+ os_helper.unlink(ABSTFN + '/self')
+ os_helper.unlink(ABSTFN + '/link')
safe_rmdir(ABSTFN)
@unittest.skipUnless(hasattr(os, "symlink"),
@@ -430,11 +432,11 @@ class PosixPathTest(unittest.TestCase):
self.assertEqual(realpath(ABSTFN + '/%d' % depth), ABSTFN)
# Test using relative path as well.
- with support.change_cwd(ABSTFN):
+ with os_helper.change_cwd(ABSTFN):
self.assertEqual(realpath('%d' % depth), ABSTFN)
finally:
for i in range(depth + 1):
- support.unlink(ABSTFN + '/%d' % i)
+ os_helper.unlink(ABSTFN + '/%d' % i)
safe_rmdir(ABSTFN)
@unittest.skipUnless(hasattr(os, "symlink"),
@@ -450,10 +452,10 @@ class PosixPathTest(unittest.TestCase):
os.mkdir(ABSTFN + "/y")
os.symlink(ABSTFN + "/y", ABSTFN + "/k")
- with support.change_cwd(ABSTFN + "/k"):
+ with os_helper.change_cwd(ABSTFN + "/k"):
self.assertEqual(realpath("a"), ABSTFN + "/y/a")
finally:
- support.unlink(ABSTFN + "/k")
+ os_helper.unlink(ABSTFN + "/k")
safe_rmdir(ABSTFN + "/y")
safe_rmdir(ABSTFN)
@@ -477,11 +479,11 @@ class PosixPathTest(unittest.TestCase):
# Absolute path.
self.assertEqual(realpath(ABSTFN + "/link-y/.."), ABSTFN + "/k")
# Relative path.
- with support.change_cwd(dirname(ABSTFN)):
+ with os_helper.change_cwd(dirname(ABSTFN)):
self.assertEqual(realpath(basename(ABSTFN) + "/link-y/.."),
ABSTFN + "/k")
finally:
- support.unlink(ABSTFN + "/link-y")
+ os_helper.unlink(ABSTFN + "/link-y")
safe_rmdir(ABSTFN + "/k/y")
safe_rmdir(ABSTFN + "/k")
safe_rmdir(ABSTFN)
@@ -497,12 +499,12 @@ class PosixPathTest(unittest.TestCase):
os.mkdir(ABSTFN)
os.mkdir(ABSTFN + "/k")
os.symlink(ABSTFN, ABSTFN + "link")
- with support.change_cwd(dirname(ABSTFN)):
+ with os_helper.change_cwd(dirname(ABSTFN)):
base = basename(ABSTFN)
self.assertEqual(realpath(base + "link"), ABSTFN)
self.assertEqual(realpath(base + "link/k"), ABSTFN + "/k")
finally:
- support.unlink(ABSTFN + "link")
+ os_helper.unlink(ABSTFN + "link")
safe_rmdir(ABSTFN + "/k")
safe_rmdir(ABSTFN)
@@ -627,9 +629,9 @@ class PathLikeTests(unittest.TestCase):
path = posixpath
def setUp(self):
- self.file_name = support.TESTFN
- self.file_path = FakePath(support.TESTFN)
- self.addCleanup(support.unlink, self.file_name)
+ self.file_name = os_helper.TESTFN
+ self.file_path = FakePath(os_helper.TESTFN)
+ self.addCleanup(os_helper.unlink, self.file_name)
with open(self.file_name, 'xb', 0) as file:
file.write(b"test_posixpath.PathLikeTests")
diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py
index 0096456..b58f28a 100644
--- a/Lib/test/test_py_compile.py
+++ b/Lib/test/test_py_compile.py
@@ -228,7 +228,7 @@ class PyCompileCLITestCase(unittest.TestCase):
file.write('x = 123\n')
def tearDown(self):
- support.rmtree(self.directory)
+ os_helper.rmtree(self.directory)
def pycompilecmd(self, *args, **kwargs):
# assert_python_* helpers don't return proc object. We'll just use
diff --git a/Lib/test/test_source_encoding.py b/Lib/test/test_source_encoding.py
index 5ca4346..b410c03 100644
--- a/Lib/test/test_source_encoding.py
+++ b/Lib/test/test_source_encoding.py
@@ -1,7 +1,9 @@
# -*- coding: koi8-r -*-
import unittest
-from test.support import TESTFN, unlink, unload, rmtree, script_helper, captured_stdout
+from test.support import script_helper, captured_stdout
+from test.support.os_helper import TESTFN, unlink, rmtree
+from test.support.import_helper import unload
import importlib
import os
import sys
diff --git a/Lib/test/test_startfile.py b/Lib/test/test_startfile.py
index 1a26a80..589ffa2 100644
--- a/Lib/test/test_startfile.py
+++ b/Lib/test/test_startfile.py
@@ -9,6 +9,7 @@
import unittest
from test import support
+from test.support import os_helper
import os
import platform
import sys
@@ -27,7 +28,7 @@ class TestCase(unittest.TestCase):
# we're not about to delete. If we're running under -j, that
# means the test harness provided directory isn't a safe option.
# See http://bugs.python.org/issue15526 for more details
- with support.change_cwd(path.dirname(sys.executable)):
+ with os_helper.change_cwd(path.dirname(sys.executable)):
empty = path.join(path.dirname(__file__), "empty.vbs")
startfile(empty)
startfile(empty, "open")
diff --git a/Lib/test/test_sundry.py b/Lib/test/test_sundry.py
index 2accad1..04e572c 100644
--- a/Lib/test/test_sundry.py
+++ b/Lib/test/test_sundry.py
@@ -3,15 +3,17 @@ import importlib
import platform
import sys
from test import support
+from test.support import import_helper
+from test.support import warnings_helper
import unittest
class TestUntestedModules(unittest.TestCase):
def test_untested_modules_can_be_imported(self):
untested = ('encodings', 'formatter')
- with support.check_warnings(quiet=True):
+ with warnings_helper.check_warnings(quiet=True):
for name in untested:
try:
- support.import_module('test.test_{}'.format(name))
+ import_helper.import_module('test.test_{}'.format(name))
except unittest.SkipTest:
importlib.import_module(name)
else:
diff --git a/Lib/test/test_winconsoleio.py b/Lib/test/test_winconsoleio.py
index a44f7bb..1807e47 100644
--- a/Lib/test/test_winconsoleio.py
+++ b/Lib/test/test_winconsoleio.py
@@ -6,7 +6,7 @@ import os
import sys
import tempfile
import unittest
-from test import support
+from test.support import os_helper
if sys.platform != 'win32':
raise unittest.SkipTest("test only relevant on win32")
@@ -109,7 +109,7 @@ class WindowsConsoleIOTests(unittest.TestCase):
def test_conout_path(self):
temp_path = tempfile.mkdtemp()
- self.addCleanup(support.rmtree, temp_path)
+ self.addCleanup(os_helper.rmtree, temp_path)
conout_path = os.path.join(temp_path, 'CONOUT$')
diff --git a/Lib/test/test_zoneinfo/_support.py b/Lib/test/test_zoneinfo/_support.py
index 0fe162c..5a76c16 100644
--- a/Lib/test/test_zoneinfo/_support.py
+++ b/Lib/test/test_zoneinfo/_support.py
@@ -3,7 +3,7 @@ import functools
import sys
import threading
import unittest
-from test.support import import_fresh_module
+from test.support.import_helper import import_fresh_module
OS_ENV_LOCK = threading.Lock()
TZPATH_LOCK = threading.Lock()