comparison tests/test.py @ 65:83327bc715be

make the virtualenv convenience method return more stuff
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 01 Mar 2012 18:31:52 -0800
parents bb8d993376aa
children e62d2fddb275
comparison
equal deleted inserted replaced
64:bb8d993376aa 65:83327bc715be
19 from optparse import OptionParser 19 from optparse import OptionParser
20 20
21 def create_virtualenv(path): 21 def create_virtualenv(path):
22 """create a virtualenv and return the path to the python interpreter therein""" 22 """create a virtualenv and return the path to the python interpreter therein"""
23 virtualenv.create_environment(path) 23 virtualenv.create_environment(path)
24 for python in (('bin', 'python'), ('Scripts', 'python.exe')): 24 for scripts, ext in (('bin', ''), ('Scripts', '.exe')):
25 python = os.path.join(path, *python) 25 scripts = os.path.join(path, scripts)
26 if os.path.exists(python): 26 if os.path.exists(scripts):
27 return python 27 break
28 raise Exception("Python binary not found in %s" % path) 28 else:
29 raise Exception("bin/Scripts not found in %s" % path)
30 binaries = ['python', 'easy_install', 'pip']
31 binaries = dict([(i, i + ext) for i in binaries])
32 return type('virtualenv', (), binaries)
29 33
30 def run_tests(raise_on_error=False, report_first=False): 34 def run_tests(raise_on_error=False, report_first=False):
31 35
32 # add results here 36 # add results here
33 results = {} 37 results = {}