]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-108927: Fix test_import + test_importlib + test_unittest problem (#108929)
authorNikita Sobolev <mail@sobolevn.me>
Tue, 5 Sep 2023 18:57:48 +0000 (21:57 +0300)
committerGitHub <noreply@github.com>
Tue, 5 Sep 2023 18:57:48 +0000 (18:57 +0000)
Lib/test/test_unittest/test_discovery.py

index 946fa1258ea25ecf90f8cfad9d65956224765cf8..004898ed43183485e2eb649ce3a94721e200a67d 100644 (file)
@@ -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),