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 22f3425

Browse filesBrowse files
authored
gh-103247: clear the module cache in a test in test_importlib/extensions/test_loader.py (GH-104226)
1 parent 29f348e commit 22f3425
Copy full SHA for 22f3425

File tree

1 file changed

+10
-9
lines changed
Filter options

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
@@ -262,15 +262,16 @@ def test_reload(self):
262262

263263
def test_try_registration(self):
264264
# Assert that the PyState_{Find,Add,Remove}Module C API doesn't work.
265-
module = self.load_module()
266-
with self.subTest('PyState_FindModule'):
267-
self.assertEqual(module.call_state_registration_func(0), None)
268-
with self.subTest('PyState_AddModule'):
269-
with self.assertRaises(SystemError):
270-
module.call_state_registration_func(1)
271-
with self.subTest('PyState_RemoveModule'):
272-
with self.assertRaises(SystemError):
273-
module.call_state_registration_func(2)
265+
with util.uncache(self.name):
266+
module = self.load_module()
267+
with self.subTest('PyState_FindModule'):
268+
self.assertEqual(module.call_state_registration_func(0), None)
269+
with self.subTest('PyState_AddModule'):
270+
with self.assertRaises(SystemError):
271+
module.call_state_registration_func(1)
272+
with self.subTest('PyState_RemoveModule'):
273+
with self.assertRaises(SystemError):
274+
module.call_state_registration_func(2)
274275

275276
def test_load_submodule(self):
276277
# 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.