[FIX] test phantomjs manually delete localstorage
authorAntony Lesuisse <al@openerp.com>
Mon, 30 Jun 2014 15:23:38 +0000 (17:23 +0200)
committerAntony Lesuisse <al@openerp.com>
Mon, 30 Jun 2014 15:23:38 +0000 (17:23 +0200)
openerp/tests/common.py

index 4d4417e..50b8555 100644 (file)
@@ -5,6 +5,7 @@ helpers and classes to write tests.
 
 """
 import errno
+import glob
 import json
 import logging
 import os
@@ -170,7 +171,6 @@ class HttpCase(TransactionCase):
         self.session_id = self.session.sid
         self.session.db = DB
         openerp.http.root.session_store.save(self.session)
-        self.localstorage_path = mkdtemp()
         # setup an url opener helper
         self.opener = urllib2.OpenerDirector()
         self.opener.add_handler(urllib2.UnknownHandler())
@@ -181,7 +181,6 @@ class HttpCase(TransactionCase):
         self.opener.addheaders.append(('Cookie', 'session_id=%s' % self.session_id))
 
     def tearDown(self):
-        rmtree(self.localstorage_path)
         self.registry.leave_test_mode()
         super(HttpCase, self).tearDown()
 
@@ -254,6 +253,11 @@ class HttpCase(TransactionCase):
 
     def phantom_run(self, cmd, timeout):
         _logger.info('phantom_run executing %s', ' '.join(cmd))
+
+        ls_glob = os.path.expanduser('~/.qws/share/data/Ofi Labs/PhantomJS/http_localhost_%s.*'%PORT)
+        for i in glob.glob(ls_glob):
+            _logger.info('phantomjs unlink localstorage %s', i)
+            os.unlink(i)
         try:
             phantom = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
         except OSError:
@@ -296,7 +300,6 @@ class HttpCase(TransactionCase):
         # phantom.args[1] == options
         cmd = [
             'phantomjs',
-            '--local-storage-path', self.localstorage_path,
             jsfile, phantomtest, json.dumps(options)
         ]
         self.phantom_run(cmd, timeout)