diff --git a/src/funkload/Distributed.py b/src/funkload/Distributed.py index 02ec298b..4dcc31b0 100644 --- a/src/funkload/Distributed.py +++ b/src/funkload/Distributed.py @@ -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) diff --git a/src/funkload/PatchWebunit.py b/src/funkload/PatchWebunit.py index 6936ef3b..61c513d0 100644 --- a/src/funkload/PatchWebunit.py +++ b/src/funkload/PatchWebunit.py @@ -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 diff --git a/src/funkload/utils.py b/src/funkload/utils.py index 0f10288a..1d47b12c 100644 --- a/src/funkload/utils.py +++ b/src/funkload/utils.py @@ -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