##// END OF EJS Templates
increase timeout for startup
Matthias Bussonnier -
Show More
@@ -1,74 +1,77 b''
1 """Test embedding of IPython"""
1 """Test embedding of IPython"""
2
2
3 #-----------------------------------------------------------------------------
3 #-----------------------------------------------------------------------------
4 # Copyright (C) 2013 The IPython Development Team
4 # Copyright (C) 2013 The IPython Development Team
5 #
5 #
6 # Distributed under the terms of the BSD License. The full license is in
6 # Distributed under the terms of the BSD License. The full license is in
7 # the file COPYING, distributed as part of this software.
7 # the file COPYING, distributed as part of this software.
8 #-----------------------------------------------------------------------------
8 #-----------------------------------------------------------------------------
9
9
10 #-----------------------------------------------------------------------------
10 #-----------------------------------------------------------------------------
11 # Imports
11 # Imports
12 #-----------------------------------------------------------------------------
12 #-----------------------------------------------------------------------------
13
13
14 import os
14 import os
15 import sys
15 import sys
16 from IPython.testing.decorators import skip_win32
16 from IPython.testing.decorators import skip_win32
17
17
18 #-----------------------------------------------------------------------------
18 #-----------------------------------------------------------------------------
19 # Tests
19 # Tests
20 #-----------------------------------------------------------------------------
20 #-----------------------------------------------------------------------------
21
21
22 @skip_win32
22 @skip_win32
23 def test_debug_magic_passes_through_generators():
23 def test_debug_magic_passes_through_generators():
24 """
24 """
25 This test that we can correctly pass through frames of a generator post-mortem.
25 This test that we can correctly pass through frames of a generator post-mortem.
26 """
26 """
27 import pexpect
27 import pexpect
28 import re
28 import re
29 in_prompt = re.compile(br'In ?\[\d+\]:')
29 in_prompt = re.compile(br'In ?\[\d+\]:')
30 ipdb_prompt = 'ipdb>'
30 ipdb_prompt = 'ipdb>'
31 env = os.environ.copy()
31 env = os.environ.copy()
32 child = pexpect.spawn(sys.executable, ['-m', 'IPython', '--colors=nocolor', '--simple-prompt'],
32 child = pexpect.spawn(sys.executable, ['-m', 'IPython', '--colors=nocolor', '--simple-prompt'],
33 env=env)
33 env=env)
34 child.timeout = 2
34 child.timeout = 15
35
35
36 child.expect(in_prompt)
36 child.expect(in_prompt)
37
38 child.timeout = 2
39
37 child.sendline("def f(x):")
40 child.sendline("def f(x):")
38 child.sendline(" raise Exception")
41 child.sendline(" raise Exception")
39 child.sendline("")
42 child.sendline("")
40
43
41 child.expect(in_prompt)
44 child.expect(in_prompt)
42 child.sendline("gen = (f(x) for x in [0])")
45 child.sendline("gen = (f(x) for x in [0])")
43 child.sendline("")
46 child.sendline("")
44
47
45 child.expect(in_prompt)
48 child.expect(in_prompt)
46 child.sendline("for x in gen:")
49 child.sendline("for x in gen:")
47 child.sendline(" pass")
50 child.sendline(" pass")
48 child.sendline("")
51 child.sendline("")
49
52
50 child.expect('Exception:')
53 child.expect('Exception:')
51
54
52 child.expect(in_prompt)
55 child.expect(in_prompt)
53 child.sendline(r'%debug')
56 child.sendline(r'%debug')
54 child.expect('----> 2 raise Exception')
57 child.expect('----> 2 raise Exception')
55
58
56 child.expect(ipdb_prompt)
59 child.expect(ipdb_prompt)
57 child.sendline('u')
60 child.sendline('u')
58 child.expect_exact(r'----> 1 gen = (f(x) for x in [0])')
61 child.expect_exact(r'----> 1 gen = (f(x) for x in [0])')
59
62
60 child.expect(ipdb_prompt)
63 child.expect(ipdb_prompt)
61 child.sendline('u')
64 child.sendline('u')
62 child.expect_exact('----> 1 for x in gen:')
65 child.expect_exact('----> 1 for x in gen:')
63
66
64 child.expect(ipdb_prompt)
67 child.expect(ipdb_prompt)
65 child.sendline('u')
68 child.sendline('u')
66 child.expect_exact('*** Oldest frame')
69 child.expect_exact('*** Oldest frame')
67
70
68 child.expect(ipdb_prompt)
71 child.expect(ipdb_prompt)
69 child.sendline('exit')
72 child.sendline('exit')
70
73
71 child.expect(in_prompt)
74 child.expect(in_prompt)
72 child.sendline('exit')
75 child.sendline('exit')
73
76
74 child.close()
77 child.close()
General Comments 0
You need to be logged in to leave comments. Login now