Yuya Nishihara  committed 056f9f3

tests: allow to run some tests without display

  • Participants
  • Parent commits 9b85b1e
  • Branches stable

Comments (0)

Files changed (3)

File tests/

     def _setupqapp(self):
         # Make sure to hold single QApplication instance on memory. Multiple
         # instances will lead crash.
-        self._qapp = QApplication([])
+        guienabled = ( == 'nt' or sys.platform == 'darwin'
+                      or bool(os.environ.get('DISPLAY')))
+        self._qapp = QApplication([], guienabled)
         # settings will be saved at $HGTMP/.config/TortoiseHg/TortoiseHgQt.ini

File tests/

 import os, sys, unittest
 from nose.plugins.skip import SkipTest
 from PyQt4.QtCore import QModelIndex, QString
+from PyQt4.QtGui import QApplication
 from tortoisehg.hgqt import thgrepo
 from tortoisehg.hgqt.manifestmodel import ManifestModel
 import helpers
 def setup():
+    # necessary for style().standardIcon()
+    if QApplication.type() != QApplication.GuiClient:
+        raise SkipTest
     global _tmpdir
     _tmpdir = helpers.mktmpdir(__name__)

File tests/widget/

 """Unit tests of hgqt widgets"""
+from nose.plugins.skip import SkipTest
+from PyQt4.QtGui import QApplication
+def setup():
+    if QApplication.type() != QApplication.GuiClient:
+        raise SkipTest