Only run GUI test when DISPLAY variable is set.

This commit is contained in:
Bastian Kleineidam 2011-01-09 09:55:16 -06:00
parent 34d5b01e4c
commit ec2806588f
3 changed files with 10 additions and 2 deletions

View file

@ -1,2 +1 @@
- Only run GUI tests when X server is available (ie. DISPLAY is set)
- Port to Python 3.x (will not happen anytime soon though)

View file

@ -183,6 +183,14 @@ def has_pyqt ():
need_pyqt = _need_func(has_pyqt, "PyQT")
@memoized
def has_x11 ():
"""Test if DISPLAY variable is set."""
return os.getenv('DISPLAY') is not None
need_x11 = _need_func(has_x11, 'X11')
@contextmanager
def _limit_time (seconds):
"""Raises LinkCheckerInterrupt if given number of seconds have passed."""

View file

@ -16,13 +16,14 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import unittest
import sys
from tests import need_pyqt
from tests import need_pyqt, need_x11
class TestGui (unittest.TestCase):
"""Test OMT GUI client."""
@need_pyqt
@need_x11
def test_gui (self):
from PyQt4 import QtCore, QtGui, QtTest
from linkcheck.gui import LinkCheckerMain