Ensures that the CLI refuses to overwrite signature files CLI :: -h without --overwrite-signature
(capfd, hello_world_f90, monkeypatch)
| 184 | |
| 185 | |
| 186 | def 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)), |
nothing calls this directly
no test coverage detected