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

Function test_gen_pyf_no_overwrite

numpy/f2py/tests/test_f2py2e.py:186–198  ·  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

184
185
186def test_gen_pyf_no_overwrite(capfd, hello_world_f90, monkeypatch):
187 """Ensures that the CLI refuses to overwrite signature files
188 CLI :: -h without --overwrite-signature
189 """
190 ipath = Path(hello_world_f90)
191 monkeypatch.setattr(sys, "argv", f'f2py -h faker.pyf {ipath}'.split())
192
193 with util.switchdir(ipath.parent):
194 Path("faker.pyf").write_text("Fake news", encoding="ascii")
195 with pytest.raises(SystemExit):
196 f2pycli() # Refuse to overwrite
197 _, err = capfd.readouterr()
198 assert "Use --overwrite-signature to overwrite" in err
199
200
201@pytest.mark.skipif((platform.system() != 'Linux') or (sys.version_info <= (3, 12)),

Callers

nothing calls this directly

Calls 2

splitMethod · 0.45
write_textMethod · 0.45

Tested by

no test coverage detected