##// END OF EJS Templates
Remove yield test that are not support by pytest anymore...
Remove yield test that are not support by pytest anymore And remove comparison of str/unicode as it is not relevant anymore as both are the same. We can now unpin pytest as well, which we should make sure is in release notes and in the conda-forge recipe As nose does not understand `@parametrize`, and the nose `@skip` decorator messes with that as well, we mark tests with parametrize as not-tests for iptests

File last commit:

r25049:e8d8a60c
r26183:61376395
Show More
test_debug_magic.py
78 lines | 2.3 KiB | text/x-python | PythonLexer
Matthias Bussonnier
Add test that %depug pass through generators.
r24683 """Test embedding of IPython"""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
import os
import sys
from IPython.testing.decorators import skip_win32
Miro Hrončok
Tests: Allow setting a custom timeout scale...
r25049 from IPython.testing import IPYTHON_TESTING_TIMEOUT_SCALE
Matthias Bussonnier
Add test that %depug pass through generators.
r24683
#-----------------------------------------------------------------------------
# Tests
#-----------------------------------------------------------------------------
@skip_win32
def test_debug_magic_passes_through_generators():
"""
This test that we can correctly pass through frames of a generator post-mortem.
"""
import pexpect
import re
Mickaël Schoentgen
Fix several DeprecationWarning: invalid escape sequence...
r24896 in_prompt = re.compile(br'In ?\[\d+\]:')
Matthias Bussonnier
Add test that %depug pass through generators.
r24683 ipdb_prompt = 'ipdb>'
env = os.environ.copy()
child = pexpect.spawn(sys.executable, ['-m', 'IPython', '--colors=nocolor', '--simple-prompt'],
env=env)
Miro Hrončok
Tests: Allow setting a custom timeout scale...
r25049 child.timeout = 15 * IPYTHON_TESTING_TIMEOUT_SCALE
Matthias Bussonnier
Add test that %depug pass through generators.
r24683
child.expect(in_prompt)
Matthias Bussonnier
increase timeout for startup
r24945
Miro Hrončok
Tests: Allow setting a custom timeout scale...
r25049 child.timeout = 2 * IPYTHON_TESTING_TIMEOUT_SCALE
Matthias Bussonnier
increase timeout for startup
r24945
Matthias Bussonnier
Add test that %depug pass through generators.
r24683 child.sendline("def f(x):")
child.sendline(" raise Exception")
child.sendline("")
child.expect(in_prompt)
child.sendline("gen = (f(x) for x in [0])")
child.sendline("")
child.expect(in_prompt)
child.sendline("for x in gen:")
child.sendline(" pass")
child.sendline("")
child.expect('Exception:')
child.expect(in_prompt)
child.sendline(r'%debug')
child.expect('----> 2 raise Exception')
child.expect(ipdb_prompt)
child.sendline('u')
child.expect_exact(r'----> 1 gen = (f(x) for x in [0])')
child.expect(ipdb_prompt)
child.sendline('u')
child.expect_exact('----> 1 for x in gen:')
child.expect(ipdb_prompt)
child.sendline('u')
child.expect_exact('*** Oldest frame')
child.expect(ipdb_prompt)
child.sendline('exit')
child.expect(in_prompt)
child.sendline('exit')
child.close()