@@ -232,21 +232,35 @@ def tests_from_zip(mod_name, zip_fname):
232
232
233
233
def sdist_tests (mod_name , repo_path = None ):
234
234
""" Make sdist zip, install from it, and run tests """
235
+ buildzip_run_tests (mod_name , 'sdist --formats=zip' , '*.zip' , repo_path )
236
+
237
+ sdist_tests .__test__ = False
238
+
239
+
240
+ def bdist_egg_tests (mod_name , repo_path = None ):
241
+ """ Make bdist_egg, install from it, and run tests """
242
+ buildzip_run_tests (mod_name , 'bdist_egg' , '*.egg' , repo_path )
243
+
244
+ bdist_egg_tests .__test__ = False
245
+
246
+
247
+ def buildzip_run_tests (mod_name , setup_params , zipglob , repo_path = None ):
235
248
pwd = os .path .abspath (os .getcwd ())
236
249
if repo_path is None :
237
250
repo_path = pwd
238
251
install_path = tempfile .mkdtemp ()
239
252
try :
240
253
os .chdir (repo_path )
241
- my_call ('python setup.py sdist --formats=zip --dist-dir='
242
- + install_path )
243
- zip_fnames = glob (pjoin (install_path , mod_name + "*.zip" ))
244
- if len (zip_fnames ) != 1 :
245
- raise OSError ('There must be one and only one zip file, '
246
- 'but I found "%s"' % ': ' .join (zip_fnames ))
247
- tests_from_zip (mod_name , zip_fnames [0 ])
254
+ my_call ('python setup.py %s --dist-dir=%s'
255
+ % (setup_params , install_path ))
256
+ zips = glob (pjoin (install_path , zipglob ))
257
+ if len (zips ) != 1 :
258
+ raise OSError ('There must be one and only one %s file, '
259
+ 'but I found "%s"' %
260
+ (zipglob , ': ' .join (zips )))
261
+ tests_from_zip (mod_name , zips [0 ])
248
262
finally :
249
263
os .chdir (pwd )
250
264
shutil .rmtree (install_path )
251
265
252
- sdist_tests .__test__ = False
266
+ buildzip_run_tests .__test__ = False
0 commit comments