Skip to content

Commit b4e0cd4

Browse files
committed
Extract fixture for SiteDir.
1 parent 74528ef commit b4e0cd4

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

importlib_resources/tests/test_files.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,16 @@ def setUp(self):
4747
self.data = namespacedata01
4848

4949

50-
class ModulesFilesTests(unittest.TestCase):
50+
class SiteDir:
5151
def setUp(self):
5252
self.fixtures = contextlib.ExitStack()
5353
self.addCleanup(self.fixtures.close)
5454
self.site_dir = self.fixtures.enter_context(os_helper.temp_dir())
5555
self.fixtures.enter_context(import_helper.DirsOnSysPath(self.site_dir))
5656
self.fixtures.enter_context(import_helper.CleanImport())
5757

58+
59+
class ModulesFilesTests(SiteDir, unittest.TestCase):
5860
def test_module_resources(self):
5961
"""
6062
A module can have resources found adjacent to the module.
@@ -70,14 +72,7 @@ def test_module_resources(self):
7072
assert actual == spec['res.txt']
7173

7274

73-
class ImplicitContextFilesTests(unittest.TestCase):
74-
def setUp(self):
75-
self.fixtures = contextlib.ExitStack()
76-
self.addCleanup(self.fixtures.close)
77-
self.site_dir = self.fixtures.enter_context(os_helper.temp_dir())
78-
self.fixtures.enter_context(import_helper.DirsOnSysPath(self.site_dir))
79-
self.fixtures.enter_context(import_helper.CleanImport())
80-
75+
class ImplicitContextFilesTests(SiteDir, unittest.TestCase):
8176
@__import__('pytest').mark.xfail(reason="work in progress")
8277
def test_implicit_files(self):
8378
"""

0 commit comments

Comments
 (0)