mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
Issue #14500: Fix importlib.test.import_.test_packages to clean up
after itself properly.
This commit is contained in:
parent
83c02ee8e8
commit
d62cd5627f
1 changed files with 5 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ from . import util as import_util
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
import importlib
|
import importlib
|
||||||
|
from test import support
|
||||||
|
|
||||||
|
|
||||||
class ParentModuleTests(unittest.TestCase):
|
class ParentModuleTests(unittest.TestCase):
|
||||||
|
|
@ -38,7 +39,10 @@ class ParentModuleTests(unittest.TestCase):
|
||||||
module_code={'mod': module_injection})
|
module_code={'mod': module_injection})
|
||||||
with mock_modules as mock:
|
with mock_modules as mock:
|
||||||
with util.import_state(meta_path=[mock]):
|
with util.import_state(meta_path=[mock]):
|
||||||
submodule = import_util.import_(subname)
|
try:
|
||||||
|
submodule = import_util.import_(subname)
|
||||||
|
finally:
|
||||||
|
support.unload(subname)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue