##// END OF EJS Templates
skip tests when display variable is not set
Paul Ivanov -
Show More
@@ -6,7 +6,9 b' from IPython.external.qt import QtCore, QtGui'
6 6
7 7 # Local imports
8 8 from IPython.qt.console.console_widget import ConsoleWidget
9 import IPython.testing.decorators as dec
9 10
11 setup = dec.skip_file_no_x11(__name__)
10 12
11 13 class TestConsoleWidget(unittest.TestCase):
12 14
@@ -6,7 +6,9 b' from IPython.external.qt import QtGui'
6 6
7 7 # Local imports
8 8 from IPython.qt.console.kill_ring import KillRing, QtKillRing
9 import IPython.testing.decorators as dec
9 10
11 setup = dec.skip_file_no_x11(__name__)
10 12
11 13 class TestKillRing(unittest.TestCase):
12 14
@@ -49,6 +49,7 b' Authors'
49 49
50 50 # Stdlib imports
51 51 import sys
52 import os
52 53 import tempfile
53 54 import unittest
54 55
@@ -295,6 +296,19 b' def module_not_available(module):'
295 296
296 297 return mod_not_avail
297 298
299
300 def decorated_dummy(dec, name):
301 """Return a dummy function decorated with dec, with the given name.
302
303 Examples
304 --------
305 import IPython.testing.decorators as dec
306 setup = dec.decorated_dummy(dec.skip_if_no_x11, __name__)
307 """
308 dummy = lambda: None
309 dummy.__name__ = name
310 return dec(dummy)
311
298 312 #-----------------------------------------------------------------------------
299 313 # Decorators for public use
300 314
@@ -314,6 +328,17 b" skip_if_not_linux = skipif(not sys.platform.startswith('linux'),"
314 328 skip_if_not_osx = skipif(sys.platform != 'darwin',
315 329 "This test only runs under OSX")
316 330
331
332 _x11_skip_cond = (sys.platform not in ('darwin', 'win32') and
333 os.environ['DISPLAY']=='')
334 _x11_skip_msg = "Skipped under *nix when X11/XOrg not available"
335
336 skip_if_no_x11 = skipif(_x11_skip_cond, _x11_skip_msg)
337
338 # not a decorator itself, returns a dummy function to be used as setup
339 def skip_file_no_x11(name):
340 return decorated_dummy(skip_if_no_x11, name) if _x11_skip_cond else None
341
317 342 # Other skip decorators
318 343
319 344 # generic skip without module
General Comments 0
You need to be logged in to leave comments. Login now