|
9 | 9 | import textwrap |
10 | 10 | import unittest |
11 | 11 | from test import support |
| 12 | +from test.support import os_helper |
12 | 13 | from test.support.script_helper import ( |
13 | 14 | spawn_python, kill_python, assert_python_ok, assert_python_failure, |
14 | 15 | interpreter_requires_environment |
@@ -141,11 +142,11 @@ def test_run_code(self): |
141 | 142 | # All good if execution is successful |
142 | 143 | assert_python_ok('-c', 'pass') |
143 | 144 |
|
144 | | - @unittest.skipUnless(support.FS_NONASCII, 'need support.FS_NONASCII') |
| 145 | + @unittest.skipUnless(os_helper.FS_NONASCII, 'need os_helper.FS_NONASCII') |
145 | 146 | def test_non_ascii(self): |
146 | 147 | # Test handling of non-ascii data |
147 | 148 | command = ("assert(ord(%r) == %s)" |
148 | | - % (support.FS_NONASCII, ord(support.FS_NONASCII))) |
| 149 | + % (os_helper.FS_NONASCII, ord(os_helper.FS_NONASCII))) |
149 | 150 | assert_python_ok('-c', command) |
150 | 151 |
|
151 | 152 | # On Windows, pass bytes to subprocess doesn't test how Python decodes the |
@@ -463,8 +464,8 @@ def test_del___main__(self): |
463 | 464 | # Issue #15001: PyRun_SimpleFileExFlags() did crash because it kept a |
464 | 465 | # borrowed reference to the dict of __main__ module and later modify |
465 | 466 | # the dict whereas the module was destroyed |
466 | | - filename = support.TESTFN |
467 | | - self.addCleanup(support.unlink, filename) |
| 467 | + filename = os_helper.TESTFN |
| 468 | + self.addCleanup(os_helper.unlink, filename) |
468 | 469 | with open(filename, "w") as script: |
469 | 470 | print("import sys", file=script) |
470 | 471 | print("del sys.modules['__main__']", file=script) |
@@ -499,7 +500,7 @@ def test_isolatedmode(self): |
499 | 500 | # dummyvar to prevent extraneous -E |
500 | 501 | dummyvar="") |
501 | 502 | self.assertEqual(out.strip(), b'1 1 1') |
502 | | - with support.temp_cwd() as tmpdir: |
| 503 | + with os_helper.temp_cwd() as tmpdir: |
503 | 504 | fake = os.path.join(tmpdir, "uuid.py") |
504 | 505 | main = os.path.join(tmpdir, "main.py") |
505 | 506 | with open(fake, "w") as f: |
@@ -561,7 +562,7 @@ def test_set_pycache_prefix(self): |
561 | 562 | elif opt is not None: |
562 | 563 | args[:0] = ['-X', f'pycache_prefix={opt}'] |
563 | 564 | with self.subTest(envval=envval, opt=opt): |
564 | | - with support.temp_cwd(): |
| 565 | + with os_helper.temp_cwd(): |
565 | 566 | assert_python_ok(*args, **env) |
566 | 567 |
|
567 | 568 | def run_xdev(self, *args, check_exitcode=True, xdev=True): |
@@ -644,7 +645,8 @@ def test_xdev(self): |
644 | 645 |
|
645 | 646 | def check_warnings_filters(self, cmdline_option, envvar, use_pywarning=False): |
646 | 647 | if use_pywarning: |
647 | | - code = ("import sys; from test.support import import_fresh_module; " |
| 648 | + code = ("import sys; from test.support.import_helper import " |
| 649 | + "import_fresh_module; " |
648 | 650 | "warnings = import_fresh_module('warnings', blocked=['_warnings']); ") |
649 | 651 | else: |
650 | 652 | code = "import sys, warnings; " |
|
0 commit comments