bpo-33755: Fix importlib.resources isolation tests (#7412)
This commit is contained in:
parent
dde9fdbe45
commit
ac1ee1bada
|
@ -2,7 +2,7 @@ import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from . import data01
|
from . import data01
|
||||||
from . import zipdata02
|
from . import zipdata01, zipdata02
|
||||||
from . import util
|
from . import util
|
||||||
from importlib import resources, import_module
|
from importlib import resources, import_module
|
||||||
|
|
||||||
|
@ -109,6 +109,10 @@ class ResourceFromZipsTest(util.ZipSetupBase, unittest.TestCase):
|
||||||
set(resources.contents('ziptestdata.two')),
|
set(resources.contents('ziptestdata.two')),
|
||||||
{'__init__.py', 'resource2.txt'})
|
{'__init__.py', 'resource2.txt'})
|
||||||
|
|
||||||
|
|
||||||
|
class SubdirectoryResourceFromZipsTest(util.ZipSetupBase, unittest.TestCase):
|
||||||
|
ZIP_MODULE = zipdata01 # type: ignore
|
||||||
|
|
||||||
def test_is_submodule_resource(self):
|
def test_is_submodule_resource(self):
|
||||||
submodule = import_module('ziptestdata.subdirectory')
|
submodule = import_module('ziptestdata.subdirectory')
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
|
|
|
@ -549,6 +549,10 @@ class ZipSetupBase:
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
modules = support.modules_setup()
|
||||||
|
self.addCleanup(support.modules_cleanup, *modules)
|
||||||
|
|
||||||
|
|
||||||
class ZipSetup(ZipSetupBase):
|
class ZipSetup(ZipSetupBase):
|
||||||
ZIP_MODULE = zipdata01 # type: ignore
|
ZIP_MODULE = zipdata01 # type: ignore
|
||||||
|
|
Loading…
Reference in New Issue