Skip to content

Commit d94af3f

Browse files
authored
bpo-40275: Remove test helpers aliases in test.support (GH-21771)
1 parent a4084b9 commit d94af3f

4 files changed

Lines changed: 10 additions & 23 deletions

File tree

Lib/ctypes/test/test_loading.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import unittest
77
import test.support
88
from test.support import import_helper
9+
from test.support import os_helper
910
from ctypes.util import find_library
1011

1112
libc_name = None
@@ -125,7 +126,7 @@ def test_load_dll_with_flags(self):
125126
else:
126127
ext = ".dll"
127128

128-
with test.support.temp_dir() as tmp:
129+
with os_helper.temp_dir() as tmp:
129130
# We copy two files and load _sqlite3.dll (formerly .pyd),
130131
# which has a dependency on sqlite3.dll. Then we test
131132
# loading it in subprocesses to avoid it starting in memory

Lib/test/support/__init__.py

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,6 @@
1414
import types
1515
import unittest
1616

17-
from .import_helper import (
18-
CleanImport, DirsOnSysPath, _ignore_deprecated_imports,
19-
_save_and_block_module, _save_and_remove_module,
20-
forget, import_fresh_module, import_module, make_legacy_pyc,
21-
modules_cleanup, modules_setup, unload)
22-
from .os_helper import (
23-
FS_NONASCII, SAVEDCWD, TESTFN, TESTFN_ASCII, TESTFN_NONASCII,
24-
TESTFN_UNENCODABLE, TESTFN_UNDECODABLE,
25-
TESTFN_UNICODE, can_symlink, can_xattr,
26-
change_cwd, create_empty_file, fd_count,
27-
fs_is_case_insensitive, make_bad_fd, rmdir,
28-
rmtree, skip_unless_symlink, skip_unless_xattr,
29-
temp_cwd, temp_dir, temp_umask, unlink,
30-
EnvironmentVarGuard, FakePath, _longpath)
31-
from .warnings_helper import (
32-
WarningsRecorder, _filterwarnings,
33-
check_no_resource_warning, check_no_warnings,
34-
check_syntax_warning, check_warnings, ignore_warnings)
35-
3617
from .testresult import get_test_runner
3718

3819

@@ -506,6 +487,7 @@ def check_syntax_error(testcase, statement, errtext='', *, lineno=None, offset=N
506487

507488
def open_urlresource(url, *args, **kw):
508489
import urllib.request, urllib.parse
490+
from .os_helper import unlink
509491
try:
510492
import gzip
511493
except ImportError:
@@ -1326,6 +1308,8 @@ def skip_if_buggy_ucrt_strfptime(test):
13261308
class PythonSymlink:
13271309
"""Creates a symlink for the current Python executable"""
13281310
def __init__(self, link=None):
1311+
from .os_helper import TESTFN
1312+
13291313
self.link = link or os.path.abspath(TESTFN)
13301314
self._linked = []
13311315
self.real = os.path.realpath(sys.executable)
@@ -1980,6 +1964,7 @@ def skip_if_broken_multiprocessing_synchronize():
19801964
is no available semaphore implementation, or if creating a lock raises an
19811965
OSError (on Linux only).
19821966
"""
1967+
from .import_helper import import_module
19831968

19841969
# Skip tests if the _multiprocessing extension is missing.
19851970
import_module('_multiprocessing')

Lib/test/test_os.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import uuid
3131
import warnings
3232
from test import support
33+
from test.support import import_helper
3334
from test.support import os_helper
3435
from test.support import socket_helper
3536
from test.support import threading_helper
@@ -2674,8 +2675,8 @@ def test_unlink_removes_junction(self):
26742675
@unittest.skipUnless(sys.platform == "win32", "Win32 specific tests")
26752676
class Win32NtTests(unittest.TestCase):
26762677
def test_getfinalpathname_handles(self):
2677-
nt = support.import_module('nt')
2678-
ctypes = support.import_module('ctypes')
2678+
nt = import_helper.import_module('nt')
2679+
ctypes = import_helper.import_module('ctypes')
26792680
import ctypes.wintypes
26802681

26812682
kernel = ctypes.WinDLL('Kernel32.dll', use_last_error=True)

Lib/test/test_posixpath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from test import test_genericpath
66
from test.support import import_helper
77
from test.support import os_helper
8-
from test.support import FakePath
8+
from test.support.os_helper import FakePath
99
from unittest import mock
1010

1111
try:

0 commit comments

Comments
 (0)