Should return one of the npx candidates on Windows.
(monkeypatch: pytest.MonkeyPatch)
| 95 | |
| 96 | |
| 97 | def test_get_npx_windows(monkeypatch: pytest.MonkeyPatch): |
| 98 | """Should return one of the npx candidates on Windows.""" |
| 99 | candidates = ["npx.cmd", "npx.exe", "npx"] |
| 100 | |
| 101 | def fake_run(cmd: list[str], **kw: Any) -> subprocess.CompletedProcess[bytes]: |
| 102 | if cmd[0] in candidates: |
| 103 | return subprocess.CompletedProcess(cmd, 0) |
| 104 | else: # pragma: no cover |
| 105 | raise subprocess.CalledProcessError(1, cmd[0]) |
| 106 | |
| 107 | monkeypatch.setattr(sys, "platform", "win32") |
| 108 | monkeypatch.setattr(subprocess, "run", fake_run) |
| 109 | assert _get_npx_command() in candidates |
| 110 | |
| 111 | |
| 112 | def test_get_npx_returns_none_when_npx_missing(monkeypatch: pytest.MonkeyPatch): |
nothing calls this directly
no test coverage detected