Skip to content

Commit

Permalink
Merge pull request #134 from filosi/filosi-patch
Browse files Browse the repository at this point in the history
Filosi patch
  • Loading branch information
bdelbosc committed Oct 22, 2014
2 parents e0230ac + b2259b3 commit c4d3883
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/funkload/Distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,11 +492,13 @@ def local_prep_worker(worker):
worker.execute("mkdir -p %s" % virtual_env)
worker.put(
get_virtualenv_script(),
os.path.join(remote_res_dir, "virtualenv.py"))
## os.path.join(remote_res_dir, "virtualenv.py"))
os.path.join(remote_res_dir, "tmpvenv.py"))

trace(".")
worker.execute(
"%s virtualenv.py %s" % (
# "%s virtualenv.py %s" % (
"%s tmpvenv.py %s" % (
self.python_bin, os.path.join(remote_res_dir, self.tarred_testsdir)),
cwdir=remote_res_dir)

Expand Down
2 changes: 1 addition & 1 deletion src/funkload/PatchWebunit.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def decodeCookies(url, server, headers, cookies):
if maxage != '':
timedelta = int(maxage)
if timedelta > 0:
expire = now + timedelta
expire = now + datetime.timedelta(seconds=timedelta)
else:
if cookie['expires'] == '':
expire = datetime.datetime.max
Expand Down
16 changes: 12 additions & 4 deletions src/funkload/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,19 @@ def get_virtualenv_script():
installed in the system. if it doesn't exist returns
None.
"""
pkg = pkg_resources.get_distribution('virtualenv')
script_path = os.path.join( pkg.location, 'virtualenv.py')
try:
import virtualenv
except ImportError:
raise ImportError('No module named virtualenv')

if os.path.isfile( script_path ):
return script_path
pkg = pkg_resources.get_distribution('virtualenv')
output = virtualenv.create_bootstrap_script('import os')
fpath = os.path.join(os.path.abspath('/tmp'),'tmpvenv.py')
f = open(fpath, 'w').write(output)
# script_path = os.path.join( pkg.location, 'virtualenv.py')

if os.path.isfile( fpath ):
return fpath
else:
return None

Expand Down

0 comments on commit c4d3883

Please sign in to comment.