Commit f73ececa authored by Akim Demaille's avatar Akim Demaille
Browse files

Tests: add logs

It took me way too long to understand the new failure...
parent 45e95439
......@@ -25,10 +25,12 @@ tests = ['non-verbose', 'verbose']
## Python. ##
## -------- ##
print("Checking Python")
for t in tests:
try:
# IPython needs `.ipy` files, but Python doesn't care,
# so the tests scripts have the `ipy` extension.
print("testing: {}".format(mefile(t, 'ipy')))
subprocess.check_output([config('configuration.python'), mefile(t, 'ipy')],
stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
......@@ -37,30 +39,33 @@ for t in tests:
output = re.sub(r'(?m)^.*[Ww]arning.*\n?', '', output)
## Clean up paths and line numbers
output = canonical(output)
print("canonical output: {}".format(output))
with open(mefile(t, 'py.out')) as f:
CHECK_EQ(f.read(), output)
else:
FAIL(mefile(t, 'ipy'), 'did not fail!')
## --------- ##
## IPython. ##
## --------- ##
# Check for IPython
print("Checking for IPython")
ipython = None
if 'missing' in config('configuration.ipython'):
ipy = config('configuration.ipython')
if 'missing' in ipy:
SKIP('missing IPython')
else:
try: # Check that ipython is running Python 3.
subprocess.check_output([config('configuration.ipython'), '-c',
subprocess.check_output([ipy, '-c',
'import sys; assert sys.version_info.major >= 3'])
except Exception as e:
SKIP(config('configuration.ipython'), 'runs Python < 3', e)
SKIP(ipy, 'runs Python < 3', e)
else:
print("{} run Python >= 3".format(ipy))
# Check that IPython is at least IPython 3.
try:
res = subprocess.check_output([config('configuration.ipython'), '-c',
res = subprocess.check_output([ipy, '-c',
'import IPython; assert IPython.version_info[0] >= 3'])
# Eliminate possible escapes to change the terminal title.
res = canonical(res.decode("utf-8"))
......@@ -68,11 +73,13 @@ else:
except Exception as e:
SKIP("runs IPython <= 3, tracebacks won't be filtered correctly", e)
else:
ipython = config('configuration.ipython')
ipython = ipy
if ipython:
print("Checking IPython")
for t in tests:
# IPython doesn't fail and prints on stdout,
print("running {} {}".format(ipython, mefile(t, 'ipy')))
# so not try..except, redirection to stdout nor warning removal here.
# However the warnings will still appear on stderr, so redirect to devnull.
output = subprocess.check_output([ipython, mefile(t, 'ipy')],
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment