##// END OF EJS Templates
Fix up and move old irunner tests into proper test suite.
Fernando Perez -
Show More
@@ -306,8 +306,8 b' class IPythonRunner(InteractiveRunner):'
306 306 args0 = ['--colors','NoColor',
307 307 '-pi1','In [\\#]: ',
308 308 '-pi2',' .\\D.: ',
309 '--noterm-title',
310 '--no-auto-indent']
309 '--no-term-title',
310 '--no-autoindent']
311 311 if args is None: args = args0
312 312 else: args = args0 + args
313 313 prompts = [r'In \[\d+\]: ',r' \.*: ']
@@ -1,4 +1,3 b''
1 #!/usr/bin/env python
2 1 """Test suite for the irunner module.
3 2
4 3 Not the most elegant or fine-grained, but it does cover at least the bulk
@@ -13,7 +12,7 b' import sys'
13 12 import unittest
14 13
15 14 # IPython imports
16 from IPython import irunner
15 from IPython.lib import irunner
17 16
18 17 # Testing code begins
19 18 class RunnerTestCase(unittest.TestCase):
@@ -29,12 +28,12 b' class RunnerTestCase(unittest.TestCase):'
29 28 out = self.out.getvalue()
30 29 #out = ''
31 30 # this output contains nasty \r\n lineends, and the initial ipython
32 # banner. clean it up for comparison
33 output_l = output.split()
34 out_l = out.split()
31 # banner. clean it up for comparison, removing lines of whitespace
32 output_l = [l for l in output.splitlines() if l and not l.isspace()]
33 out_l = [l for l in out.splitlines() if l and not l.isspace()]
35 34 mismatch = 0
36 #if len(output_l) != len(out_l):
37 # self.fail('mismatch in number of lines')
35 if len(output_l) != len(out_l):
36 self.fail('mismatch in number of lines')
38 37 for n in range(len(output_l)):
39 38 # Do a line-by-line comparison
40 39 ol1 = output_l[n].strip()
@@ -53,7 +52,6 b' class RunnerTestCase(unittest.TestCase):'
53 52 """Test the IPython runner."""
54 53 source = """
55 54 print 'hello, this is python'
56
57 55 # some more code
58 56 x=1;y=2
59 57 x+y**2
@@ -99,11 +97,10 b' In [7]: autocall 0'
99 97 Automatic calling is: OFF
100 98
101 99 In [8]: cos pi
102 ------------------------------------------------------------
103 100 File "<ipython console>", line 1
104 101 cos pi
105 102 ^
106 <type 'exceptions.SyntaxError'>: invalid syntax
103 SyntaxError: invalid syntax
107 104
108 105
109 106 In [9]: cos(pi)
@@ -163,6 +160,3 b' hello, this is python'
163 160 that's all folks!
164 161 """
165 162 self._test_runner(runner,source,output)
166
167 if __name__ == '__main__':
168 unittest.main()
General Comments 0
You need to be logged in to leave comments. Login now