devtools/qunit.py
branchstable
changeset 8226 a3d3bdd46463
parent 7879 9aae456abab5
child 8257 d54fc706d623
--- a/devtools/qunit.py	Mon Feb 13 12:45:21 2012 +0100
+++ b/devtools/qunit.py	Mon Feb 13 12:47:59 2012 +0100
@@ -70,13 +70,16 @@
         fnull = open(os.devnull, 'w')
         stdout = TemporaryFile()
         stderr = TemporaryFile()
+        self.firefox_cmd = ['firefox', '-no-remote']
+        if os.name == 'posix':
+            self.firefox_cmd = ['xvfb-run', '-a'] + self.firefox_cmd
         try:
             home = osp.expanduser('~')
             user = getlogin()
             assert os.access(home, os.W_OK), \
                    'No write access to your home directory, Firefox will crash.'\
                    ' Are you sure "%s" is a valid home  for user "%s"' % (home, user)
-            check_call(['firefox', '-no-remote', '-CreateProfile',
+            check_call(self.firefox_cmd + ['-CreateProfile',
                         '%s %s' % (self._profile_name, self._tmp_dir)],
                                   stdout=stdout, stderr=stderr)
         except CalledProcessError, cpe:
@@ -87,7 +90,7 @@
     def start(self, url):
         self.stop()
         fnull = open(os.devnull, 'w')
-        self._process = Popen(['firefox', '-no-remote', '-P', self._profile_name, url],
+        self._process = Popen(self.firefox_cmd + ['-P', self._profile_name, url],
                               stdout=fnull, stderr=fnull)
 
     def stop(self):