Skip to content

Commit

Permalink
[FIX] use unique localstorage path when running phantomjs tests
Browse files Browse the repository at this point in the history
this patch use a unique localstorage per test at al request. It could have used one localstorage per instance or even per module.
  • Loading branch information
sle-odoo committed Jun 26, 2014
1 parent 45a120d commit ebb3f1a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion openerp/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import urllib2
import xmlrpclib
from datetime import datetime, timedelta
from shutil import rmtree
from tempfile import mkdtemp

import werkzeug

Expand Down Expand Up @@ -149,8 +151,10 @@ def setUp(self):
self.session_id = self.session.sid
self.session.db = DB
openerp.http.root.session_store.save(self.session)
self.localstorage_path = mkdtemp()

def tearDown(self):
rmtree(self.localstorage_path)
self.registry.leave_test_mode()
super(HttpCase, self).tearDown()

Expand Down Expand Up @@ -259,7 +263,11 @@ def phantom_jsfile(self, jsfile, timeout=60, **kw):
phantomtest = os.path.join(os.path.dirname(__file__), 'phantomtest.js')
# phantom.args[0] == phantomtest path
# phantom.args[1] == options
cmd = ['phantomjs', jsfile, phantomtest, json.dumps(options)]
cmd = [
'phantomjs',
'--local-storage-path', self.localstorage_path,
jsfile, phantomtest, json.dumps(options)
]
self.phantom_run(cmd, timeout)

def phantom_js(self, url_path, code, ready="window", login=None, timeout=60, **kw):
Expand Down

0 comments on commit ebb3f1a

Please sign in to comment.