Skip to content

Commit 625df69

Browse files
committed
Extract class attribute for the test root. DRY.
1 parent b4af125 commit 625df69

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

importlib_metadata/tests/test_zip.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515

1616

1717
class TestZip(unittest.TestCase):
18+
root = 'importlib_metadata.tests.data'
19+
1820
def setUp(self):
1921
# Find the path to the example-*.whl so we can add it to the front of
2022
# sys.path, where we'll then try to find the metadata thereof.
2123
self.resources = ExitStack()
2224
self.addCleanup(self.resources.close)
2325
wheel = self.resources.enter_context(
24-
path('importlib_metadata.tests.data',
25-
'example-21.12-py3-none-any.whl'))
26+
path(self.root, 'example-21.12-py3-none-any.whl'))
2627
sys.path.insert(0, str(wheel))
2728
self.resources.callback(sys.path.pop, 0)
2829

@@ -53,8 +54,7 @@ def setUp(self):
5354
self.resources = ExitStack()
5455
self.addCleanup(self.resources.close)
5556
egg = self.resources.enter_context(
56-
path('importlib_metadata.tests.data',
57-
'example-21.12-py3.6.egg'))
57+
path(self.root, 'example-21.12-py3.6.egg'))
5858
sys.path.insert(0, str(egg))
5959
self.resources.callback(sys.path.pop, 0)
6060

0 commit comments

Comments
 (0)