fix: report WaveTone launch runtime errors

This commit is contained in:
Shuhan Zhang
2026-06-03 17:19:53 +08:00
parent 94d2550b42
commit b3c5fe1cd3
5 changed files with 25 additions and 10 deletions
+2 -2
View File
@@ -1228,7 +1228,7 @@ gimp 107 passed ✅ (64 unit + 43 e2e)
blender 208 passed ✅ (150 unit + 58 e2e)
inkscape 202 passed ✅ (148 unit + 54 e2e)
audacity 161 passed ✅ (107 unit + 54 e2e)
wavetone 23 passed ✅ (18 unit + 5 e2e)
wavetone 24 passed ✅ (19 unit + 5 e2e)
libreoffice 158 passed ✅ (89 unit + 69 e2e)
mubu 96 passed ✅ (85 unit + 11 e2e)
obs-studio 153 passed ✅ (116 unit + 37 e2e)
@@ -1308,7 +1308,7 @@ cli-anything/
├── 🧊 blender/agent-harness/ # Blender CLI (208 tests)
├── ✏️ inkscape/agent-harness/ # Inkscape CLI (202 tests)
├── 🎵 audacity/agent-harness/ # Audacity CLI (161 tests)
├── wavetone/agent-harness/ # WaveTone CLI (23 tests: 18 unit + 5 e2e)
├── wavetone/agent-harness/ # WaveTone CLI (24 tests: 19 unit + 5 e2e)
├── 🌐 browser/agent-harness/ # Browser CLI (DOMShell MCP, new)
├── 📄 libreoffice/agent-harness/ # LibreOffice CLI (158 tests)
├── 📧 mailchimp/agent-harness/ # Mailchimp Marketing API CLI (303 commands, 36 unit tests)
+2 -2
View File
@@ -679,7 +679,7 @@ gimp 107 passed ✅ (64 unit + 43 e2e)
blender 208 passed ✅ (150 unit + 58 e2e)
inkscape 202 passed ✅ (148 unit + 54 e2e)
audacity 161 passed ✅ (107 unit + 54 e2e)
wavetone 23 passed ✅ (18 unit + 5 e2e)
wavetone 24 passed ✅ (19 unit + 5 e2e)
libreoffice 158 passed ✅ (89 unit + 69 e2e)
obs-studio 153 passed ✅ (116 unit + 37 e2e)
kdenlive 155 passed ✅ (111 unit + 44 e2e)
@@ -753,7 +753,7 @@ cli-anything/
├── 🧊 blender/agent-harness/ # Blender CLI208 项测试)
├── ✏️ inkscape/agent-harness/ # Inkscape CLI202 项测试)
├── 🎵 audacity/agent-harness/ # Audacity CLI161 项测试)
├── wavetone/agent-harness/ # WaveTone CLI23 项测试:18 unit + 5 e2e
├── wavetone/agent-harness/ # WaveTone CLI24 项测试:19 unit + 5 e2e
├── 📄 libreoffice/agent-harness/ # LibreOffice CLI158 项测试)
├── 📚 zotero/agent-harness/ # Zotero CLI(新增,支持文献导入)
├── 📓 joplin/agent-harness/ # Joplin CLI134 测试:107 单元 + 27 e2e
@@ -2,7 +2,7 @@
## Test Inventory Plan
- `test_core.py`: 18 unit tests for project manifests, audio probing, session logs,
- `test_core.py`: 19 unit tests for project manifests, audio probing, session logs,
and backend discovery.
- `test_full_e2e.py`: 5 E2E tests covering CLI subprocess workflows and real
WaveTone launch smoke coverage.
@@ -28,6 +28,7 @@
invocations.
- Return a failing exit status for launch smoke checks when the backend exits
early with a nonzero code.
- Convert launch runtime errors to clean CLI errors.
- Reject GUI launch attempts on non-Windows hosts with a clear error.
- Strip Windows REPL path quotes while preserving backslashes.
@@ -81,7 +82,7 @@ python -m pytest cli_anything\wavetone\tests\ -v -s
Result:
```text
collected 23 items
collected 24 items
cli_anything/wavetone/tests/test_core.py::test_create_project_manifest PASSED
cli_anything/wavetone/tests/test_core.py::test_rejects_unsupported_audio PASSED
@@ -99,6 +100,7 @@ cli_anything/wavetone/tests/test_core.py::test_session_rejects_invalid_schema PA
cli_anything/wavetone/tests/test_core.py::test_find_wavetone_from_env PASSED
cli_anything/wavetone/tests/test_core.py::test_cli_preserves_inherited_project_and_json_context PASSED
cli_anything/wavetone/tests/test_core.py::test_wavetone_launch_fails_on_early_nonzero_exit PASSED
cli_anything/wavetone/tests/test_core.py::test_wavetone_launch_reports_runtime_errors PASSED
cli_anything/wavetone/tests/test_core.py::test_launch_requires_windows PASSED
cli_anything/wavetone/tests/test_core.py::test_repl_split_strips_windows_quotes PASSED
cli_anything/wavetone/tests/test_full_e2e.py::TestCLISubprocess::test_help PASSED
@@ -107,7 +109,7 @@ cli_anything/wavetone/tests/test_full_e2e.py::TestCLISubprocess::test_formats_js
cli_anything/wavetone/tests/test_full_e2e.py::TestRealWaveToneBackend::test_doctor_real_backend PASSED
cli_anything/wavetone/tests/test_full_e2e.py::TestRealWaveToneBackend::test_launch_real_backend_with_wav PASSED
23 passed in 3.22s
24 passed in 3.39s
```
## Coverage Notes
@@ -117,8 +119,8 @@ cli_anything/wavetone/tests/test_full_e2e.py::TestRealWaveToneBackend::test_laun
audio probing, malformed WAV fallback, session logs, session schema and
payload validation, backend discovery, ffprobe argument construction,
ffprobe metadata parsing, inherited CLI project and JSON context, failed
launch smoke reporting, Windows launch gating, and REPL Windows path
splitting.
launch smoke reporting, launch runtime error reporting, Windows launch gating,
and REPL Windows path splitting.
- CLI subprocess tests resolve and use the installed `cli-anything-wavetone`
entry point.
- Real backend coverage launches `C:\Users\Hp\Desktop\wavetone2.6.1\wavetone.exe`
@@ -261,6 +261,19 @@ def test_wavetone_launch_fails_on_early_nonzero_exit(monkeypatch: pytest.MonkeyP
assert data["launch"]["exit_code"] == 42
def test_wavetone_launch_reports_runtime_errors(monkeypatch: pytest.MonkeyPatch) -> None:
def fake_launch_wavetone(**kwargs: object) -> dict[str, object]:
raise RuntimeError("WaveTone launch requires Windows")
monkeypatch.setattr(wavetone_backend, "launch_wavetone", fake_launch_wavetone)
result = CliRunner().invoke(cli, ["--json", "wavetone", "launch"])
assert result.exit_code == 1
assert "WaveTone launch requires Windows" in result.output
assert "Traceback" not in result.output
def test_launch_requires_windows(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(wavetone_backend.platform, "system", lambda: "Linux")
@@ -305,7 +305,7 @@ def wavetone_launch(ctx: click.Context, audio_path: str | None, executable: str
wait_seconds=wait_seconds,
terminate=terminate,
)
except (OSError, ValueError) as exc:
except (OSError, RuntimeError, ValueError) as exc:
raise click.ClickException(str(exc)) from exc
failed_launch = (
wait_seconds > 0