Show More
@@ -15,6 +15,14 import re | |||
|
15 | 15 | from IPython.lib import irunner |
|
16 | 16 | from IPython.testing import decorators |
|
17 | 17 | |
|
18 | def pylab_not_importable(): | |
|
19 | """Test if importing pylab fails with RuntimeError (true when having no display)""" | |
|
20 | try: | |
|
21 | import pylab | |
|
22 | return False | |
|
23 | except RuntimeError: | |
|
24 | return True | |
|
25 | ||
|
18 | 26 | # Testing code begins |
|
19 | 27 | class RunnerTestCase(unittest.TestCase): |
|
20 | 28 | |
@@ -57,6 +65,7 class RunnerTestCase(unittest.TestCase): | |||
|
57 | 65 | self.assert_(mismatch==0,'Number of mismatched lines: %s' % |
|
58 | 66 | mismatch) |
|
59 | 67 | |
|
68 | @decorators.skipif(pylab_not_importable, "Likely a run without X.") | |
|
60 | 69 | @decorators.skipif_not_matplotlib |
|
61 | 70 | def test_pylab_import_all_enabled(self): |
|
62 | 71 | "Verify that plot is available when pylab_import_all = True" |
@@ -82,6 +91,7 Out\[6\]: True | |||
|
82 | 91 | runner = irunner.IPythonRunner(out=self.out) |
|
83 | 92 | self._test_runner(runner,source,output) |
|
84 | 93 | |
|
94 | @decorators.skipif(pylab_not_importable, "Likely a run without X.") | |
|
85 | 95 | @decorators.skipif_not_matplotlib |
|
86 | 96 | def test_pylab_import_all_disabled(self): |
|
87 | 97 | "Verify that plot is not available when pylab_import_all = False" |
General Comments 0
You need to be logged in to leave comments.
Login now