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