From 17f7e02a51cb54dbef2ad95a9d66024b9fb511de Mon Sep 17 00:00:00 2001 From: filosi Date: Mon, 20 Oct 2014 14:39:41 +0200 Subject: [PATCH 1/4] Fixed Bug on line 221 of PatchWebunit.py, sum datetime and timedelta --- src/funkload/PatchWebunit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From d380588cb2e2e8bb2123d5b64fcfab408864a32f Mon Sep 17 00:00:00 2001 From: filosi Date: Tue, 21 Oct 2014 15:04:23 +0200 Subject: [PATCH 2/4] Fixing bug on distribute script creating virtualenv --- src/funkload/utils.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/funkload/utils.py b/src/funkload/utils.py index 0f10288a..bd899256 100644 --- a/src/funkload/utils.py +++ b/src/funkload/utils.py @@ -317,11 +317,20 @@ 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.realpath(__file__),'virtualenv.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 From a2608900dd16df658a974ddae7b09f81098147a4 Mon Sep 17 00:00:00 2001 From: filosi Date: Wed, 22 Oct 2014 09:57:01 +0200 Subject: [PATCH 3/4] Correct script for creating virtualenv in distributed task --- src/funkload/Distributed.py | 6 ++++-- src/funkload/utils.py | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) 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/utils.py b/src/funkload/utils.py index bd899256..2bbbb1c0 100644 --- a/src/funkload/utils.py +++ b/src/funkload/utils.py @@ -322,14 +322,15 @@ def get_virtualenv_script(): except ImportError: raise ImportError('No module named virtualenv') - pkg = pkg_resources.get_distribution('virtualenv') output = virtualenv.create_bootstrap_script('import os') - fpath = os.path.join(os.path.realpath(__file__),'virtualenv.py') + fpath = os.path.join(os.path.abspath('/tmp'),'tmpvenv.py') + print fpath f = open(fpath, 'w').write(output) # script_path = os.path.join( pkg.location, 'virtualenv.py') if os.path.isfile( fpath ): + print 'Ciao' return fpath else: return None From b2259b3b1aaa780d3346031afa3cd1028aeeba2f Mon Sep 17 00:00:00 2001 From: filosi Date: Wed, 22 Oct 2014 10:07:22 +0200 Subject: [PATCH 4/4] Cleanup debug prints --- src/funkload/utils.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/funkload/utils.py b/src/funkload/utils.py index 2bbbb1c0..1d47b12c 100644 --- a/src/funkload/utils.py +++ b/src/funkload/utils.py @@ -325,12 +325,10 @@ def get_virtualenv_script(): pkg = pkg_resources.get_distribution('virtualenv') output = virtualenv.create_bootstrap_script('import os') fpath = os.path.join(os.path.abspath('/tmp'),'tmpvenv.py') - print fpath f = open(fpath, 'w').write(output) # script_path = os.path.join( pkg.location, 'virtualenv.py') if os.path.isfile( fpath ): - print 'Ciao' return fpath else: return None