bpo-40275: Use new test.support helper submodules in tests (GH-21219)
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py
index 7675a97..793c99a 100644
--- a/Lib/test/libregrtest/main.py
+++ b/Lib/test/libregrtest/main.py
@@ -216,7 +216,7 @@
# regex to match 'test_builtin' in line:
# '0:00:00 [ 4/400] test_builtin -- test_dict took 1 sec'
regex = re.compile(r'\btest_[a-zA-Z0-9_]+\b')
- with open(os.path.join(support.SAVEDCWD, self.ns.fromfile)) as fp:
+ with open(os.path.join(os_helper.SAVEDCWD, self.ns.fromfile)) as fp:
for line in fp:
line = line.split('#', 1)[0]
line = line.strip()
@@ -559,7 +559,7 @@
for k, v in totals.items():
root.set(k, str(v))
- xmlpath = os.path.join(support.SAVEDCWD, self.ns.xmlpath)
+ xmlpath = os.path.join(os_helper.SAVEDCWD, self.ns.xmlpath)
with open(xmlpath, 'wb') as f:
for s in ET.tostringlist(root):
f.write(s)
@@ -597,7 +597,7 @@
test_cwd = 'test_python_worker_{}'.format(pid)
else:
test_cwd = 'test_python_{}'.format(pid)
- test_cwd += support.FS_NONASCII
+ test_cwd += os_helper.FS_NONASCII
test_cwd = os.path.join(self.tmp_dir, test_cwd)
return test_cwd
@@ -609,10 +609,10 @@
for name in glob.glob(path):
if os.path.isdir(name):
print("Remove directory: %s" % name)
- support.rmtree(name)
+ os_helper.rmtree(name)
else:
print("Remove file: %s" % name)
- support.unlink(name)
+ os_helper.unlink(name)
def main(self, tests=None, **kwargs):
self.parse_args(kwargs)
@@ -629,7 +629,7 @@
# Run the tests in a context manager that temporarily changes the CWD
# to a temporary and writable directory. If it's not possible to
# create or change the CWD, the original CWD will be used.
- # The original CWD is available from support.SAVEDCWD.
+ # The original CWD is available from os_helper.SAVEDCWD.
with os_helper.temp_cwd(test_cwd, quiet=True):
# When using multiprocessing, worker processes will use test_cwd
# as their parent temporary directory. So when the main process