DEVX-61: optimise slow unit tests and handle missing tea binary in TeaCLI

This commit is contained in:
emil
2026-06-26 16:09:54 +00:00
parent f1adf22c3e
commit 06e80516d4
8 changed files with 62 additions and 19 deletions
+6
View File
@@ -77,6 +77,12 @@ class TestTeaCLIRun:
with pytest.raises(TeaCLIError, match="auth error"):
cli._run(["labels", "list"])
def test_run_tea_not_found_raises_tea_error(self) -> None:
cli = TeaCLI(tea_bin="tea")
with patch("subprocess.run", side_effect=FileNotFoundError("tea not found")):
with pytest.raises(TeaCLIError, match="tea binary not found"):
cli._run(["labels", "list"])
def test_run_includes_json_flag(self) -> None:
cli = TeaCLI(tea_bin="/fake/tea")
mock_result = MagicMock(returncode=0, stdout="[]", stderr="")