Commit 4aaacd03 authored by Sebastien Robin's avatar Sebastien Robin

give more details when Xvfb or firefox fails to launch in functional tests

parent de26b39d
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
############################################################################## ##############################################################################
import os import os
import sys
import time import time
import signal import signal
import re import re
...@@ -83,7 +84,8 @@ class Xvfb: ...@@ -83,7 +84,8 @@ class Xvfb:
if subprocess.call(('xdpyinfo', '-display', display), if subprocess.call(('xdpyinfo', '-display', display),
stdout=null, stderr=subprocess.STDOUT): stdout=null, stderr=subprocess.STDOUT):
# Xvfb did not start properly so stop here # Xvfb did not start properly so stop here
raise EnvironmentError("Can not start Xvfb, stop test execution") raise EnvironmentError("Can not start Xvfb, stop test execution " \
+ "(display %r)" % (display,))
def run(self): def run(self):
for display_try in self.display_list: for display_try in self.display_list:
...@@ -108,6 +110,7 @@ class Browser: ...@@ -108,6 +110,7 @@ class Browser:
self.port = port self.port = port
def quit(self): def quit(self):
if getattr(self, "process", None) is not None:
self.process.kill() self.process.kill()
def _run(self, url, display): def _run(self, url, display):
...@@ -261,8 +264,8 @@ class FunctionalTestRunner: ...@@ -261,8 +264,8 @@ class FunctionalTestRunner:
self.user, self.password) self.user, self.password)
def test(self, debug=0): def test(self, debug=0):
xvfb = Xvfb(self.instance_home)
try: try:
xvfb = Xvfb(self.instance_home)
start = time.time() start = time.time()
if not debug: if not debug:
print("\nSet 'erp5_debug_mode' environment variable to 1" print("\nSet 'erp5_debug_mode' environment variable to 1"
...@@ -274,10 +277,12 @@ class FunctionalTestRunner: ...@@ -274,10 +277,12 @@ class FunctionalTestRunner:
if (time.time() - start) > float(self.timeout): if (time.time() - start) > float(self.timeout):
raise TimeoutError("Test took more than %s seconds" % self.timeout) raise TimeoutError("Test took more than %s seconds" % self.timeout)
except: except:
print("ERP5TypeFunctionalTestCase.test Exception: %r" % (sys.exc_info(),) print("ERP5TypeFunctionalTestCase.test Exception: %r" % (sys.exc_info(),))
raise
finally: finally:
self.browser.quit()
xvfb.quit() xvfb.quit()
if getattr(self, "browser", None) is not None:
self.browser.quit()
def processResult(self): def processResult(self):
file_content = self.getStatus().encode("utf-8", "replace") file_content = self.getStatus().encode("utf-8", "replace")
......
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