Skip to content

Commit 770811c

Browse files
HaoZekebilderbuchi
andcommitted
TST: For --lower with callstatement
Co-authored-by: bilderbuchi <[email protected]>
1 parent ab3aee3 commit 770811c

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module utils
2+
implicit none
3+
contains
4+
subroutine my_abort(message)
5+
implicit none
6+
character(len=*), intent(in) :: message
7+
!f2py callstatement PyErr_SetString(PyExc_ValueError, message);f2py_success = 0;
8+
!f2py callprotoargument char*
9+
write(0,*) "THIS SHOULD NOT APPEAR"
10+
stop 1
11+
end subroutine my_abort
12+
end module utils

numpy/f2py/tests/test_crackfortran.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,3 +403,12 @@ def test_param_eval_too_many_dims(self):
403403
dimspec = '(0:4, 3:12, 5)'
404404
pytest.raises(ValueError, crackfortran.param_eval, v, g_params, params,
405405
dimspec=dimspec)
406+
407+
@pytest.mark.slow
408+
class TestLowerF2PYDirective(util.F2PyTest):
409+
sources = [util.getpath("tests", "src", "crackfortran", "gh27697.f90")]
410+
options = ['--lower']
411+
412+
def test_no_lower_fail(self):
413+
with pytest.raises(ValueError, match='aborting directly') as exc:
414+
self.module.utils.my_abort('aborting directly')

0 commit comments

Comments
 (0)