1414 from contextlib2 import ExitStack
1515
1616
17- class BespokeLoader :
18- archive = 'bespoke'
19-
20-
2117class TestZip (unittest .TestCase ):
18+ root = 'importlib_metadata.tests.data'
19+
2220 def setUp (self ):
23- # Find the path to the example. *.whl so we can add it to the front of
21+ # Find the path to the example- *.whl so we can add it to the front of
2422 # sys.path, where we'll then try to find the metadata thereof.
2523 self .resources = ExitStack ()
2624 self .addCleanup (self .resources .close )
2725 wheel = self .resources .enter_context (
28- path ('importlib_metadata.tests.data' ,
29- 'example-21.12-py3-none-any.whl' ))
26+ path (self .root , 'example-21.12-py3-none-any.whl' ))
3027 sys .path .insert (0 , str (wheel ))
3128 self .resources .callback (sys .path .pop , 0 )
3229
@@ -48,3 +45,20 @@ def test_files(self):
4845 for file in files ('example' ):
4946 path = str (file .dist .locate_file (file ))
5047 assert '.whl/' in path , path
48+
49+
50+ class TestEgg (TestZip ):
51+ def setUp (self ):
52+ # Find the path to the example-*.egg so we can add it to the front of
53+ # sys.path, where we'll then try to find the metadata thereof.
54+ self .resources = ExitStack ()
55+ self .addCleanup (self .resources .close )
56+ egg = self .resources .enter_context (
57+ path (self .root , 'example-21.12-py3.6.egg' ))
58+ sys .path .insert (0 , str (egg ))
59+ self .resources .callback (sys .path .pop , 0 )
60+
61+ def test_files (self ):
62+ for file in files ('example' ):
63+ path = str (file .dist .locate_file (file ))
64+ assert '.egg/' in path , path
0 commit comments