Skip to content

Commit 0105fa1

Browse files
authored
Merge pull request #130 from bnavigator/xerbla-debug
expand test_xerbla_override to allow debugging
2 parents 47e3201 + 9f18918 commit 0105fa1

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

‎slycot/tests/test_exceptions.py‎

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
from slycot.exceptions import raise_if_slycot_error, \
2626
SlycotError, SlycotWarning, SlycotParameterError
27+
from slycot import _wrapper
2728

2829

2930
def assert_docstring_parse(docstring, exception_class, erange, checkvars={}):
@@ -92,7 +93,10 @@ def test_unhandled_info_iwarn():
9293

9394
# Test code for test_xerbla_override
9495
CODE = """
95-
from slycot._wrapper import ab08nd
96+
import sys
97+
sys.path.pop(0) # do not import from current directory ('')
98+
from slycot._wrapper import __file__, ab08nd
99+
print(__file__)
96100
# equil='X' is invalid
97101
out = ab08nd(1, 1, 1, [1], [1], [1], [1], equil='X')
98102
print("INFO={}".format(out[-1]))
@@ -102,7 +106,18 @@ def test_unhandled_info_iwarn():
102106
def test_xerbla_override():
103107
"""Test that Fortran routines calling XERBLA do not print to stdout."""
104108

105-
stdout = subprocess.check_output([sys.executable, '-c', CODE],
106-
stderr=subprocess.STDOUT,
107-
universal_newlines=True)
108-
assert stdout == "INFO=-1\n"
109+
try:
110+
out = subprocess.check_output([sys.executable, '-c', CODE],
111+
stderr=subprocess.STDOUT,
112+
universal_newlines=True)
113+
except subprocess.CalledProcessError as cpe:
114+
raise RuntimeError("Trying to call _wrapper.ab08nd() failed with "
115+
"returncode {}.\n"
116+
"Captured STDOUT: \n {}\n"
117+
"Captured STDERR: \n {}\n"
118+
"".format(cpe.returncode, cpe.stdout, cpe.stderr))
119+
120+
outlines = out.splitlines()
121+
assert len(outlines) == 2
122+
assert outlines[0] == _wrapper.__file__
123+
assert outlines[1] == "INFO=-1"

0 commit comments

Comments
 (0)