MCPcopy Create free account
hub / github.com/numpy/numpy / test_no_py312_distutils_fcompiler

Function test_no_py312_distutils_fcompiler

numpy/f2py/tests/test_f2py2e.py:217–245  ·  view source on GitHub ↗

Check that no distutils imports are performed on 3.12 CLI :: --fcompiler --help-link --backend distutils

(capfd, hello_world_f90, monkeypatch)

Source from the content-addressed store, hash-verified

215
216@pytest.mark.skipif((platform.system() != 'Linux') or (sys.version_info <= (3, 12)), reason='Compiler and 3.12 required')
217def test_no_py312_distutils_fcompiler(capfd, hello_world_f90, monkeypatch):
218 """Check that no distutils imports are performed on 3.12
219 CLI :: --fcompiler --help-link --backend distutils
220 """
221 MNAME = "hi"
222 foutl = get_io_paths(hello_world_f90, mname=MNAME)
223 ipath = foutl.f90inp
224 monkeypatch.setattr(
225 sys, "argv", f"f2py {ipath} -c --fcompiler=gfortran -m {MNAME}".split()
226 )
227 with util.switchdir(ipath.parent):
228 f2pycli()
229 out, _ = capfd.readouterr()
230 assert "--fcompiler cannot be used with meson" in out
231 monkeypatch.setattr(
232 sys, "argv", f"f2py --help-link".split()
233 )
234 with util.switchdir(ipath.parent):
235 f2pycli()
236 out, _ = capfd.readouterr()
237 assert "Use --dep for meson builds" in out
238 MNAME = "hi2" # Needs to be different for a new -c
239 monkeypatch.setattr(
240 sys, "argv", f"f2py {ipath} -c -m {MNAME} --backend distutils".split()
241 )
242 with util.switchdir(ipath.parent):
243 f2pycli()
244 out, _ = capfd.readouterr()
245 assert "Cannot use distutils backend with Python>=3.12" in out
246
247
248@pytest.mark.xfail

Callers

nothing calls this directly

Calls 2

get_io_pathsFunction · 0.85
splitMethod · 0.45

Tested by

no test coverage detected