diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-09-05 20:43:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-05 20:43:47 (GMT) |
commit | 460043b5548c736ac784e8a09030799322777af0 (patch) | |
tree | d815c7a9819dbdebeaf078cc55fc4f7f3bae93dc /Lib/test/test_unittest | |
parent | 3d0827e397f6d75d33e578ce4eec459458a34080 (diff) | |
download | cpython-460043b5548c736ac784e8a09030799322777af0.zip cpython-460043b5548c736ac784e8a09030799322777af0.tar.gz cpython-460043b5548c736ac784e8a09030799322777af0.tar.bz2 |
[3.12] gh-108927: Fix test_import + test_importlib + test_unittest problem (GH-108929) (#108954)
gh-108927: Fix test_import + test_importlib + test_unittest problem (GH-108929)
(cherry picked from commit 3f89b257639dd817a32079da2ae2c4436b8e82eb)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Diffstat (limited to 'Lib/test/test_unittest')
-rw-r--r-- | Lib/test/test_unittest/test_discovery.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_unittest/test_discovery.py b/Lib/test/test_unittest/test_discovery.py index 946fa12..004898e 100644 --- a/Lib/test/test_unittest/test_discovery.py +++ b/Lib/test/test_unittest/test_discovery.py @@ -6,7 +6,6 @@ import types import pickle from test import support from test.support import import_helper -import test.test_importlib.util import unittest import unittest.mock @@ -826,6 +825,8 @@ class TestDiscovery(unittest.TestCase): 'as dotted module names') def test_discovery_failed_discovery(self): + from test.test_importlib import util + loader = unittest.TestLoader() package = types.ModuleType('package') @@ -837,7 +838,7 @@ class TestDiscovery(unittest.TestCase): # Since loader.discover() can modify sys.path, restore it when done. with import_helper.DirsOnSysPath(): # Make sure to remove 'package' from sys.modules when done. - with test.test_importlib.util.uncache('package'): + with util.uncache('package'): with self.assertRaises(TypeError) as cm: loader.discover('package') self.assertEqual(str(cm.exception), |