Skip to content

Commit 38f789d

Browse files
committed
Extract fixture for SiteDir.
1 parent 8bb0635 commit 38f789d

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

importlib_resources/tests/test_files.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,16 @@ def setUp(self):
6363
self.data = namespacedata01
6464

6565

66-
class ModulesFilesTests(unittest.TestCase):
66+
class SiteDir:
6767
def setUp(self):
6868
self.fixtures = contextlib.ExitStack()
6969
self.addCleanup(self.fixtures.close)
7070
self.site_dir = self.fixtures.enter_context(os_helper.temp_dir())
7171
self.fixtures.enter_context(import_helper.DirsOnSysPath(self.site_dir))
7272
self.fixtures.enter_context(import_helper.CleanImport())
7373

74+
75+
class ModulesFilesTests(SiteDir, unittest.TestCase):
7476
def test_module_resources(self):
7577
"""
7678
A module can have resources found adjacent to the module.
@@ -86,14 +88,7 @@ def test_module_resources(self):
8688
assert actual == spec['res.txt']
8789

8890

89-
class ImplicitContextFilesTests(unittest.TestCase):
90-
def setUp(self):
91-
self.fixtures = contextlib.ExitStack()
92-
self.addCleanup(self.fixtures.close)
93-
self.site_dir = self.fixtures.enter_context(os_helper.temp_dir())
94-
self.fixtures.enter_context(import_helper.DirsOnSysPath(self.site_dir))
95-
self.fixtures.enter_context(import_helper.CleanImport())
96-
91+
class ImplicitContextFilesTests(SiteDir, unittest.TestCase):
9792
@__import__('pytest').mark.xfail(reason="work in progress")
9893
def test_implicit_files(self):
9994
"""

0 commit comments

Comments
 (0)