Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 06a0974

Browse filesBrowse files
sunmy2019miss-islington
authored andcommitted
pythongh-103247: clear the module cache in a test in test_importlib/extensions/test_loader.py (pythonGH-104226)
(cherry picked from commit 22f3425) Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
1 parent 2fa14d4 commit 06a0974
Copy full SHA for 06a0974

File tree

Expand file treeCollapse file tree

1 file changed

+10
-9
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-9
lines changed

‎Lib/test/test_importlib/extension/test_loader.py

Copy file name to clipboardExpand all lines: Lib/test/test_importlib/extension/test_loader.py
+10-9Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,16 @@ def test_reload(self):
179179

180180
def test_try_registration(self):
181181
# Assert that the PyState_{Find,Add,Remove}Module C API doesn't work.
182-
module = self.load_module()
183-
with self.subTest('PyState_FindModule'):
184-
self.assertEqual(module.call_state_registration_func(0), None)
185-
with self.subTest('PyState_AddModule'):
186-
with self.assertRaises(SystemError):
187-
module.call_state_registration_func(1)
188-
with self.subTest('PyState_RemoveModule'):
189-
with self.assertRaises(SystemError):
190-
module.call_state_registration_func(2)
182+
with util.uncache(self.name):
183+
module = self.load_module()
184+
with self.subTest('PyState_FindModule'):
185+
self.assertEqual(module.call_state_registration_func(0), None)
186+
with self.subTest('PyState_AddModule'):
187+
with self.assertRaises(SystemError):
188+
module.call_state_registration_func(1)
189+
with self.subTest('PyState_RemoveModule'):
190+
with self.assertRaises(SystemError):
191+
module.call_state_registration_func(2)
191192

192193
def test_load_submodule(self):
193194
# Test loading a simulated submodule.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.