Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
expand test_xerbla_override to allow debugging
  • Loading branch information
bnavigator committed May 20, 2020
commit 92f9be6fd86cfa5b3e2e7a84261bf13a450e8c8e
22 changes: 17 additions & 5 deletions slycot/tests/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

from slycot.exceptions import raise_if_slycot_error, \
SlycotError, SlycotWarning, SlycotParameterError
from slycot import _wrapper


def assert_docstring_parse(docstring, exception_class, erange, checkvars={}):
Expand Down Expand Up @@ -92,7 +93,8 @@ def test_unhandled_info_iwarn():

# Test code for test_xerbla_override
CODE = """
from slycot._wrapper import ab08nd
from slycot._wrapper import __file__, ab08nd
print(__file__)
# equil='X' is invalid
out = ab08nd(1, 1, 1, [1], [1], [1], [1], equil='X')
print("INFO={}".format(out[-1]))
Expand All @@ -102,7 +104,17 @@ def test_unhandled_info_iwarn():
def test_xerbla_override():
"""Test that Fortran routines calling XERBLA do not print to stdout."""

stdout = subprocess.check_output([sys.executable, '-c', CODE],
stderr=subprocess.STDOUT,
universal_newlines=True)
assert stdout == "INFO=-1\n"
ret = subprocess.run([sys.executable, '-c', CODE],
capture_output=True,
universal_newlines=True)
if ret.returncode:
raise RuntimeError("Trying to call _wrapper.ab08nd() failed with "
"returncode {}.\n"
"Captured STDOUT: \n {}\n"
"Captured STDERR: \n {}\n"
"".format(ret.returncode, ret.stdout, ret.stderr))

outlines = ret.stdout.splitlines()
assert len(outlines) == 2
assert outlines[0] == _wrapper.__file__
assert outlines[1] == "INFO=-1"