Skip to content

Commit

Permalink
Fix tests for cpaste which no longer get error raised to them.
Browse files Browse the repository at this point in the history
Less elegant than before, because we now look for the traceback being printed.
  • Loading branch information
takluyver committed Oct 14, 2011
1 parent 9281c5b commit 4d338ff
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions IPython/core/tests/test_magic.py
Expand Up @@ -326,15 +326,12 @@ def check_cpaste(code, should_fail=False):
sys.stdin = src

try:
_ip.magic('cpaste')
except:
context = tt.AssertPrints if should_fail else tt.AssertNotPrints
with context("Traceback (most recent call last)"):
_ip.magic('cpaste')

if not should_fail:
raise AssertionError("Failure not expected : '%s'" %
code)
else:
assert _ip.user_ns['code_ran']
if should_fail:
raise AssertionError("Failure expected : '%s'" % code)
assert _ip.user_ns['code_ran']
finally:
sys.stdin = stdin_save

Expand Down

0 comments on commit 4d338ff

Please sign in to comment.