Skip to content

Commit

Permalink
[FIX] openerp: tests: make failing PhantomJS tests actually fail
Browse files Browse the repository at this point in the history
  • Loading branch information
yajo authored and aab-odoo committed Oct 17, 2016
1 parent 001610e commit 85b34f4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions openerp/tests/common.py
Expand Up @@ -316,7 +316,7 @@ def phantom_poll(self, phantom, timeout):
_logger.info("phantomjs: %s", line)

if line == "ok":
break
return True
if line.startswith("error"):
line_ = line[6:]
# when error occurs the execution stack may be sent as as JSON
Expand All @@ -337,8 +337,9 @@ def phantom_run(self, cmd, timeout):
phantom = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=None)
except OSError:
raise unittest2.SkipTest("PhantomJS not found")
result = False
try:
self.phantom_poll(phantom, timeout)
result = self.phantom_poll(phantom, timeout)
finally:
# kill phantomjs if phantom.exit() wasn't called in the test
if phantom.poll() is None:
Expand All @@ -347,6 +348,10 @@ def phantom_run(self, cmd, timeout):
self._wait_remaining_requests()
# we ignore phantomjs return code as we kill it as soon as we have ok
_logger.info("phantom_run execution finished")
self.assertTrue(
result,
"PhantomJS test completed without reporting success; "
"the log may contain errors or hints.")

def _wait_remaining_requests(self):
t0 = int(time.time())
Expand Down

0 comments on commit 85b34f4

Please sign in to comment.