2424
2525from slycot .exceptions import raise_if_slycot_error , \
2626 SlycotError , SlycotWarning , SlycotParameterError
27+ from slycot import _wrapper
2728
2829
2930def 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
9495CODE = """
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
97101out = ab08nd(1, 1, 1, [1], [1], [1], [1], equil='X')
98102print("INFO={}".format(out[-1]))
@@ -102,7 +106,18 @@ def test_unhandled_info_iwarn():
102106def 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