Skip to content

Commit 491c194

Browse files
committed
Tests: fix portability to newest IPython
It now fails when an exception escapes.
1 parent f73ecec commit 491c194

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/python/tracebacks.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,14 @@ def place(m):
8080
print("Checking IPython")
8181
for t in tests:
8282
print("running {} {}".format(ipython, mefile(t, 'ipy')))
83+
# Depending on the version IPython doesn't fail and prints on stdout,
8384
# so not try..except, redirection to stdout nor warning removal here.
8485
# However the warnings will still appear on stderr, so redirect to devnull.
85-
output = subprocess.check_output([ipython, mefile(t, 'ipy')],
86-
stderr=subprocess.DEVNULL)
86+
try:
87+
output = subprocess.check_output([ipython, mefile(t, 'ipy')],
88+
stderr=subprocess.DEVNULL)
89+
except Exception as e:
90+
output = e.output
8791
output = output.decode('utf-8')
8892
## Clean up absolute paths (possibly ~/src/...).
8993
output = re.sub('~?/.*?([^/\n]+/[^/\n]+) in', r'\1 in', output)

0 commit comments

Comments
 (0)