mirror of https://github.com/python/cpython
gh-123780: Make test_pkgutil clean up `spam` module (GH-123036)
This commit is contained in:
parent
782a076362
commit
eca3fe40c2
|
@ -624,8 +624,11 @@ class ImportlibMigrationTests(unittest.TestCase):
|
|||
mod = type(sys)(name)
|
||||
del mod.__spec__
|
||||
with CleanImport(name):
|
||||
try:
|
||||
sys.modules[name] = mod
|
||||
loader = pkgutil.get_loader(name)
|
||||
finally:
|
||||
sys.modules.pop(name, None)
|
||||
self.assertIsNone(loader)
|
||||
|
||||
@ignore_warnings(category=DeprecationWarning)
|
||||
|
@ -634,8 +637,11 @@ class ImportlibMigrationTests(unittest.TestCase):
|
|||
mod = type(sys)(name)
|
||||
mod.__spec__ = None
|
||||
with CleanImport(name):
|
||||
try:
|
||||
sys.modules[name] = mod
|
||||
loader = pkgutil.get_loader(name)
|
||||
finally:
|
||||
sys.modules.pop(name, None)
|
||||
self.assertIsNone(loader)
|
||||
|
||||
@ignore_warnings(category=DeprecationWarning)
|
||||
|
|
Loading…
Reference in New Issue