Commit 8a9cdc13 authored by Julien Muchembled's avatar Julien Muchembled

Fix debug mode in functional tests ('cannot connect to X server :0' error)

parent 4c0d7bed
...@@ -132,6 +132,7 @@ class Browser: ...@@ -132,6 +132,7 @@ class Browser:
def run(self, url, display): def run(self, url, display):
self.clean() self.clean()
self.environ = os.environ.copy()
self._setEnviron() self._setEnviron()
self._setDisplay(display) self._setDisplay(display)
self._run(url) self._run(url)
...@@ -151,21 +152,25 @@ class Browser: ...@@ -151,21 +152,25 @@ class Browser:
def _setDisplay(self, display): def _setDisplay(self, display):
if display: if display:
os.environ["DISPLAY"] = display self.environ["DISPLAY"] = display
else:
xauth = os.path.expanduser('~/.Xauthority')
if os.path.exists(xauth):
self.environ["XAUTHORITY"] = xauth
def _runCommand(self, *args): def _runCommand(self, *args):
print " ".join(args) print " ".join(args)
self.process = subprocess.Popen(args, close_fds=True) self.process = subprocess.Popen(args, close_fds=True, env=self.environ)
class Firefox(Browser): class Firefox(Browser):
""" Use firefox to open run all the tests""" """ Use firefox to open run all the tests"""
def _setEnviron(self): def _setEnviron(self):
os.environ['MOZ_NO_REMOTE'] = '1' self.environ['MOZ_NO_REMOTE'] = '1'
os.environ['HOME'] = self.profile_dir self.environ['HOME'] = self.profile_dir
os.environ['LC_ALL'] = 'C' self.environ['LC_ALL'] = 'C'
os.environ["MOZ_CRASHREPORTER_DISABLE"] = "1" self.environ["MOZ_CRASHREPORTER_DISABLE"] = "1"
os.environ["NO_EM_RESTART"] = "1" self.environ["NO_EM_RESTART"] = "1"
# This disables unwanted SCIM as it fails with Xvfb, at least on Mandriva # This disables unwanted SCIM as it fails with Xvfb, at least on Mandriva
# 2010.0, because Firefox tries to start scim-bridge which SIGSEGV and # 2010.0, because Firefox tries to start scim-bridge which SIGSEGV and
...@@ -174,7 +179,7 @@ class Firefox(Browser): ...@@ -174,7 +179,7 @@ class Firefox(Browser):
'XIM_PROGRAM', 'XIM_PROGRAM',
'XMODIFIERS', 'XMODIFIERS',
'QT_IM_MODULE'): 'QT_IM_MODULE'):
os.environ.pop(remove_environment_variable, None) self.environ.pop(remove_environment_variable, None)
def _run(self, url): def _run(self, url):
# Prepare to run # Prepare to run
...@@ -183,8 +188,6 @@ class Firefox(Browser): ...@@ -183,8 +188,6 @@ class Firefox(Browser):
self._runCommand(firefox_bin, "-no-remote", self._runCommand(firefox_bin, "-no-remote",
"-profile", self.profile_dir, url) "-profile", self.profile_dir, url)
os.environ['MOZ_NO_REMOTE'] = '0'
def getPrefJs(self): def getPrefJs(self):
from App.config import getConfiguration from App.config import getConfiguration
return """ return """
......
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