8000 MAINT: Cleanup an F2PY test for backports · numpy/numpy@ccc8ba2 · GitHub
[go: up one dir, main page]

Skip to content

Commit ccc8ba2

Browse files
committed
MAINT: Cleanup an F2PY test for backports
1 parent 1a7e80f commit ccc8ba2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

numpy/f2py/tests/test_f2py2e.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
import platform
55

66
import pytest
7+
import warnings
78

89
from . import util
10+
from numpy.testing import assert_warns
911
from numpy.f2py.f2py2e import main as f2pycli
12+
from numpy.exceptions import VisibleDeprecationWarning
1013

1114
#########################
1215
# CLI utils and classes #
@@ -198,16 +201,20 @@ def test_gen_pyf_no_overwrite(capfd, hello_world_f90, monkeypatch):
198201
assert "Use --overwrite-signature to overwrite" in err
199202

200203

201-
@pytest.mark.skipif((platform.system() != 'Linux') and (sys.version_info <= (3, 12)), reason='Compiler and 3.12 required')
204+
@pytest.mark.skipif(platform.system() != 'Linux', reason = "Needs a compiler")
205+
@pytest.mark.filterwarnings("ignore")
202206
def test_untitled_cli(capfd, hello_world_f90, monkeypatch):
203207
"""Check that modules are named correctly
204208
205209
CLI :: defaults
206210
"""
211+
# Will show up on < 3.12
212+
warnings.filterwarnings('error', '', VisibleDeprecationWarning)
207213
ipath = Path(hello_world_f90)
208-
monkeypatch.setattr(sys, "argv", f"f2py --backend meson -c {ipath}".split())
214+
monkeypatch.setattr(sys, "argv", f"f2py -c {ipath}".split())
209215
with util.switchdir(ipath.parent):
210-
f2pycli()
216+
with assert_warns(UserWarning):
217+
f2pycli()
211218
out, _ = capfd.readouterr()
212219
assert "untitledmodule.c" in out
213220

0 commit comments

Comments
 (0)
0