Ensures that the CLI refuses to overwrite signature files CLI :: -h without --overwrite-signature
(capfd, hello_world_f90, monkeypatch)
| 206 | |
| 207 | |
| 208 | def 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") |
nothing calls this directly
no test coverage detected
searching dependent graphs…