diff options
author | Hai Shi <shihai1992@gmail.com> | 2020-07-09 13:25:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-09 13:25:10 (GMT) |
commit | 96a6a6d42be272a27562d98549bbffc0d1854669 (patch) | |
tree | 9c4fc12729aa2accce4ca953a6431acec87cf542 /Lib/test/test_import | |
parent | 61bb24a270d15106decb1c7983bf4c2831671a75 (diff) | |
download | cpython-96a6a6d42be272a27562d98549bbffc0d1854669.zip cpython-96a6a6d42be272a27562d98549bbffc0d1854669.tar.gz cpython-96a6a6d42be272a27562d98549bbffc0d1854669.tar.bz2 |
bpo-40275: Use new test.support helper submodules in tests (GH-21412)
Diffstat (limited to 'Lib/test/test_import')
-rw-r--r-- | Lib/test/test_import/__init__.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/Lib/test/test_import/__init__.py b/Lib/test/test_import/__init__.py index a04cf65..f4a83d2 100644 --- a/Lib/test/test_import/__init__.py +++ b/Lib/test/test_import/__init__.py @@ -19,11 +19,12 @@ import unittest from unittest import mock import test.support -from test.support import ( - TESTFN, forget, is_jython, - make_legacy_pyc, rmtree, swap_attr, swap_item, temp_umask, - unlink, unload, cpython_only, TESTFN_UNENCODABLE, - temp_dir, DirsOnSysPath) +from test.support import os_helper +from test.support import (is_jython, swap_attr, swap_item, cpython_only) +from test.support.import_helper import ( + forget, make_legacy_pyc, unlink, unload, DirsOnSysPath) +from test.support.os_helper import ( + TESTFN, rmtree, temp_umask, TESTFN_UNENCODABLE, temp_dir) from test.support import script_helper from test.support import threading_helper from test.test_importlib.util import uncache @@ -997,22 +998,22 @@ class TestSymbolicallyLinkedPackage(unittest.TestCase): tagged = package_name + '-tagged' def setUp(self): - test.support.rmtree(self.tagged) - test.support.rmtree(self.package_name) + os_helper.rmtree(self.tagged) + os_helper.rmtree(self.package_name) self.orig_sys_path = sys.path[:] # create a sample package; imagine you have a package with a tag and # you want to symbolically link it from its untagged name. os.mkdir(self.tagged) - self.addCleanup(test.support.rmtree, self.tagged) + self.addCleanup(os_helper.rmtree, self.tagged) init_file = os.path.join(self.tagged, '__init__.py') - test.support.create_empty_file(init_file) + os_helper.create_empty_file(init_file) assert os.path.exists(init_file) # now create a symlink to the tagged package # sample -> sample-tagged os.symlink(self.tagged, self.package_name, target_is_directory=True) - self.addCleanup(test.support.unlink, self.package_name) + self.addCleanup(os_helper.unlink, self.package_name) importlib.invalidate_caches() self.assertEqual(os.path.isdir(self.package_name), True) @@ -1027,7 +1028,7 @@ class TestSymbolicallyLinkedPackage(unittest.TestCase): not hasattr(sys, 'getwindowsversion') or sys.getwindowsversion() >= (6, 0), "Windows Vista or later required") - @test.support.skip_unless_symlink + @os_helper.skip_unless_symlink def test_symlinked_dir_importable(self): # make sure sample can only be imported from the current directory. sys.path[:] = ['.'] |