Show More
@@ -66,6 +66,7 b' class RunnerTestCase(unittest.TestCase):' | |||
|
66 | 66 | self.assertTrue(mismatch==0,'Number of mismatched lines: %s' % |
|
67 | 67 | mismatch) |
|
68 | 68 | |
|
69 | @decorators.skip_if_no_x11 | |
|
69 | 70 | @decorators.skipif_not_matplotlib |
|
70 | 71 | @decorators.skipif(pylab_not_importable, "Likely a run without X.") |
|
71 | 72 | def test_pylab_import_all_enabled(self): |
@@ -92,6 +93,7 b' Out\\[6\\]: True' | |||
|
92 | 93 | runner = irunner.IPythonRunner(out=self.out) |
|
93 | 94 | self._test_runner(runner,source,output) |
|
94 | 95 | |
|
96 | @decorators.skip_if_no_x11 | |
|
95 | 97 | @decorators.skipif_not_matplotlib |
|
96 | 98 | @decorators.skipif(pylab_not_importable, "Likely a run without X.") |
|
97 | 99 | def test_pylab_import_all_disabled(self): |
@@ -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.get('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