Commit 0c3bfce9 authored by Rafael Monnerat's avatar Rafael Monnerat

Move ErrorVerbose to ERP5TypeFunctionalTestCase

This change is minor and do not change the final outcome. The
intention is make Runner less dependent of the erp5 portal itself.
parent 4d539623
...@@ -91,7 +91,7 @@ class Xvfb: ...@@ -91,7 +91,7 @@ class Xvfb:
result = check_process.communicate()[0] result = check_process.communicate()[0]
if result == 'Free': if result == 'Free':
# Xvfb did not start properly so stop here # Xvfb did not start properly so stop here
raise NotImplementedError, "Can not start Xvfb, stop test execution" raise NotImplementedError, "Can not start Xvfb, stop test execution"
def run(self): def run(self):
for display_try in self.display_list: for display_try in self.display_list:
...@@ -294,20 +294,12 @@ class FunctionalTestRunner: ...@@ -294,20 +294,12 @@ class FunctionalTestRunner:
while self.getStatus() is None: while self.getStatus() is None:
time.sleep(10) time.sleep(10)
if (time.time() - start) > float(self.timeout): if (time.time() - start) > float(self.timeout):
self.verboseErrorLog()
raise TimeoutError("Test took more them %s seconds" % self.timeout) raise TimeoutError("Test took more them %s seconds" % self.timeout)
finally: finally:
self.browser.quit() self.browser.quit()
xvfb.quit() xvfb.quit()
def verboseErrorLog(self, size=10):
for entry in self.portal.error_log.getLogEntries()[:size]:
print "="*20
print "ERROR ID : %s" % entry["id"]
print "TRACEBACK :"
print entry["tb_text"]
def processResult(self): def processResult(self):
file_content = self.getStatus().encode("utf-8", "replace") file_content = self.getStatus().encode("utf-8", "replace")
sucess_amount = TEST_PASS_RE.search(file_content).group(1) sucess_amount = TEST_PASS_RE.search(file_content).group(1)
...@@ -361,6 +353,13 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase): ...@@ -361,6 +353,13 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase):
# XXX Memcached is missing # XXX Memcached is missing
# XXX Persistent cache setup is missing # XXX Persistent cache setup is missing
def _verboseErrorLog(self, size=10):
for entry in self.portal.error_log.getLogEntries()[:size]:
print "="*20
print "ERROR ID : %s" % entry["id"]
print "TRACEBACK :"
print entry["tb_text"]
def testFunctionalTestRunner(self): def testFunctionalTestRunner(self):
# first of all, abort to get rid of the mysql participation inn this # first of all, abort to get rid of the mysql participation inn this
# transaction # transaction
...@@ -373,7 +372,12 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase): ...@@ -373,7 +372,12 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase):
debug = self.foreground or os.environ.get("erp5_debug_mode") debug = self.foreground or os.environ.get("erp5_debug_mode")
self.runner.test(debug=debug) self.runner.test(debug=debug)
detail, success, failure, error_title_list = self.runner.processResult() try:
detail, success, failure, error_title_list = self.runner.processResult()
except TimeoutError, e:
self._verboseErrorLog(20)
raise TimeoutError(e)
self.logMessage("-" * 79) self.logMessage("-" * 79)
total = success + failure total = success + failure
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment