summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unittest
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2023-09-05 18:57:48 (GMT)
committerGitHub <noreply@github.com>2023-09-05 18:57:48 (GMT)
commit3f89b257639dd817a32079da2ae2c4436b8e82eb (patch)
tree1569d6dfb9e4ad31e7e1c41a4c15e6c8ca1e11a4 /Lib/test/test_unittest
parentdeea7c82682848b2a0db971a4dcc3a32c73a9f8c (diff)
downloadcpython-3f89b257639dd817a32079da2ae2c4436b8e82eb.zip
cpython-3f89b257639dd817a32079da2ae2c4436b8e82eb.tar.gz
cpython-3f89b257639dd817a32079da2ae2c4436b8e82eb.tar.bz2
gh-108927: Fix test_import + test_importlib + test_unittest problem (#108929)
Diffstat (limited to 'Lib/test/test_unittest')
-rw-r--r--Lib/test/test_unittest/test_discovery.py5
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),