Skip to content

Commit abaac82

Browse files
committed
Refactor ModuleFiles tests to make room for also testing zip files.
1 parent 0255da2 commit abaac82

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

importlib_resources/tests/test_files.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,28 @@ def setUp(self):
7272
self.fixtures.enter_context(import_helper.isolated_modules())
7373

7474

75-
class ModulesFilesTests(SiteDir, unittest.TestCase):
75+
class ModulesFiles:
76+
spec = {
77+
'mod.py': '',
78+
'res.txt': 'resources are the best',
79+
}
80+
MODULE = 'unused'
81+
7682
def test_module_resources(self):
7783
"""
7884
A module can have resources found adjacent to the module.
7985
"""
80-
spec = {
81-
'mod.py': '',
82-
'res.txt': 'resources are the best',
83-
}
84-
_path.build(spec, self.site_dir)
8586
import mod
8687

8788
actual = resources.files(mod).joinpath('res.txt').read_text(encoding='utf-8')
88-
assert actual == spec['res.txt']
89+
assert actual == self.spec['res.txt']
90+
91+
def load_fixture(self, name):
92+
self.tree_on_path(self.spec)
93+
94+
95+
class ModuleFilesDiskTests(ModulesFiles, util.DiskSetup, unittest.TestCase):
96+
pass
8997

9098

9199
class ImplicitContextFilesTests(SiteDir, unittest.TestCase):

0 commit comments

Comments
 (0)