Skip to content

Commit d982cfa

Browse files
HaoZekewarrickball
andcommitted
TST: Add one for passing arguments to f2py
Co-authored-by: warrickball <[email protected]>
1 parent 08a80a5 commit d982cfa

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
C This is an invalid file, but it does compile with -ffixed-form
2+
subroutine mwe(
3+
& x)
4+
real x
5+
end subroutine mwe

numpy/f2py/tests/test_regression.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def test_gh26148b(self):
109109
assert(res[0] == 8)
110110
assert(res[1] == 15)
111111

112+
@pytest.mark.slow
112113
def test_gh26623():
113114
# Including libraries with . should not generate an incorrect meson.build
114115
try:
@@ -119,3 +120,20 @@ def test_gh26623():
119120
)
120121
except RuntimeError as rerr:
121122
assert "lparen got assign" not in str(rerr)
123+
124+
125+
@pytest.mark.slow
126+
def test_gh25784():
127+
# Compile dubious file using passed flags
128+
try:
129+
aa = util.build_module(
130+
[util.getpath("tests", "src", "regression", "f77fixedform.f95")],
131+
options=[
132+
# Meson will collect and dedup these to pass to fortran_args:
133+
"--f77flags='-ffixed-form'",
134+
"--f90flags='-ffixed-form'",
135+
],
136+
module_name="Blah",
137+
)
138+
except ImportError as rerr:
139+
assert "unknown_subroutine_" in str(rerr)

numpy/f2py/tests/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def build_module(source_files, options=[], skip=[], only=[], module_name=None):
121121
dst_sources.append(dst)
122122

123123
base, ext = os.path.splitext(dst)
124-
if ext in (".f90", ".f", ".c", ".pyf"):
124+
if ext in (".f90", ".f95", ".f", ".c", ".pyf"):
125125
f2py_sources.append(dst)
126126

127127
assert f2py_sources

0 commit comments

Comments
 (0)