Skip to content

Commit 97d649f

Browse files
committed
NF - bdist_egg tester
1 parent 35728b7 commit 97d649f

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

nisext/testers.py

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,21 +232,35 @@ def tests_from_zip(mod_name, zip_fname):
232232

233233
def sdist_tests(mod_name, repo_path=None):
234234
""" 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):
235248
pwd = os.path.abspath(os.getcwd())
236249
if repo_path is None:
237250
repo_path = pwd
238251
install_path = tempfile.mkdtemp()
239252
try:
240253
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])
248262
finally:
249263
os.chdir(pwd)
250264
shutil.rmtree(install_path)
251265

252-
sdist_tests.__test__ = False
266+
buildzip_run_tests.__test__ = False

0 commit comments

Comments
 (0)