MCPcopy Index your code
hub / github.com/numpy/numpy / test_gen_pyf_no_overwrite

Function test_gen_pyf_no_overwrite

numpy/f2py/tests/test_f2py2e.py:208–220  ·  view source on GitHub ↗

Ensures that the CLI refuses to overwrite signature files CLI :: -h without --overwrite-signature

(capfd, hello_world_f90, monkeypatch)

Source from the content-addressed store, hash-verified

206
207
208def test_gen_pyf_no_overwrite(capfd, hello_world_f90, monkeypatch):
209 """Ensures that the CLI refuses to overwrite signature files
210 CLI :: -h without --overwrite-signature
211 """
212 ipath = Path(hello_world_f90)
213 monkeypatch.setattr(sys, "argv", f'f2py -h faker.pyf {ipath}'.split())
214
215 with util.switchdir(ipath.parent):
216 Path("faker.pyf").write_text("Fake news", encoding="ascii")
217 with pytest.raises(SystemExit):
218 f2pycli() # Refuse to overwrite
219 _, err = capfd.readouterr()
220 assert "Use --overwrite-signature to overwrite" in err
221
222
223@pytest.mark.skipif(sys.version_info <= (3, 12), reason="Python 3.12 required")

Callers

nothing calls this directly

Calls 2

splitMethod · 0.80
write_textMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…