Skip to content

"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/

Python

fix: gate WaveTone backend tests by opt-in

Shuhan Zhang5281bec239e9
diff --git a/README.md b/README.md
index 035b37dae..ac76b3900 100644
--- a/README.md
+++ b/README.md
@@ -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 25 passed ✅ (20 unit + 5 e2e)
+wavetone 25 passed ✅ (21 unit + 4 default, 2 backend-gated e2e skipped; 27 passed opt-in)
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 (25 tests: 20 unit + 5 e2e)
+├── wavetone/agent-harness/ # WaveTone CLI (27 tests: 25 default + 2 backend-gated 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)
diff --git a/README_CN.md b/README_CN.md
index c84b4859e..caedc5456 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -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 25 passed ✅ (20 unit + 5 e2e)
+wavetone 25 passed ✅ (21 unit + 4 default,2 backend-gated e2e skipped;27 passed opt-in)
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 CLI(208 项测试)
├── ✏️ inkscape/agent-harness/ # Inkscape CLI(202 项测试)
├── 🎵 audacity/agent-harness/ # Audacity CLI(161 项测试)
-├── wavetone/agent-harness/ # WaveTone CLI(25 项测试:20 unit + 5 e2e)
+├── wavetone/agent-harness/ # WaveTone CLI(27 项测试:25 default + 2 backend-gated e2e)
├── 📄 libreoffice/agent-harness/ # LibreOffice CLI(158 项测试)
├── 📚 zotero/agent-harness/ # Zotero CLI(新增,支持文献导入)
├── 📓 joplin/agent-harness/ # Joplin CLI(134 测试:107 单元 + 27 e2e)
diff --git a/wavetone/agent-harness/cli_anything/wavetone/README.md b/wavetone/agent-harness/cli_anything/wavetone/README.md
index de0f9f08f..d79626ab0 100644
--- a/wavetone/agent-harness/cli_anything/wavetone/README.md
+++ b/wavetone/agent-harness/cli_anything/wavetone/README.md
@@ -51,8 +51,8 @@ cd wavetone/agent-harness
python -m pytest cli_anything/wavetone/tests/ -v
```
-The full E2E test launches the real WaveTone executable. It requires Windows and
-a WaveTone 2.61 extraction with `wavetone.exe` and the bundled `data` directory.
-Use `WAVETONE_EXE` or `WAVETONE_HOME` to point the test at the installation. If
-the backend is unavailable, the real-backend tests are skipped and the CLI-only
-tests still run.
+The default test run skips real WaveTone backend tests so CI and contributors
+without WaveTone can still run the CLI-only suite. To opt into the real Windows
+smoke, set `CLI_ANYTHING_WAVETONE_REAL_BACKEND=1` plus `WAVETONE_EXE` or
+`WAVETONE_HOME` pointing at a WaveTone 2.61 extraction with `wavetone.exe` and
+the bundled `data` directory.
diff --git a/wavetone/agent-harness/cli_anything/wavetone/tests/TEST.md b/wavetone/agent-harness/cli_anything/wavetone/tests/TEST.md
index 97f0ac323..eb82b7543 100644
--- a/wavetone/agent-harness/cli_anything/wavetone/tests/TEST.md
+++ b/wavetone/agent-harness/cli_anything/wavetone/tests/TEST.md
@@ -2,10 +2,10 @@
## Test Inventory Plan
-- `test_core.py`: 20 unit tests for project manifests, audio probing, session logs,
+- `test_core.py`: 21 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.
+- `test_full_e2e.py`: 6 tests covering default real-backend opt-in gating, CLI
+ subprocess workflows, and real WaveTone launch smoke coverage.
## Unit Test Plan
@@ -32,6 +32,8 @@
- 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.
+- Report Click REPL exit control flow without falling through to the unexpected
+ exception handler.
## E2E Test Plan
@@ -56,7 +58,9 @@ Verified:
### CLI Backend Workflow
-Simulates an agent validating the installed WaveTone backend.
+Simulates an agent validating the installed WaveTone backend. These tests are
+skipped by default and require `CLI_ANYTHING_WAVETONE_REAL_BACKEND=1` plus
+`WAVETONE_EXE` or `WAVETONE_HOME`.
Operations:
@@ -73,17 +77,20 @@ Verified:
## Test Results
-Command:
+Default command:
```bash
$env:PATH = "$env:APPDATA\Python\Python313\Scripts;$env:PATH"
+Remove-Item Env:CLI_ANYTHING_WAVETONE_REAL_BACKEND -ErrorAction SilentlyContinue
+Remove-Item Env:WAVETONE_EXE -ErrorAction SilentlyContinue
+Remove-Item Env:WAVETONE_HOME -ErrorAction SilentlyContinue
python -m pytest cli_anything\wavetone\tests\ -v -s
```
-Result:
+Default result:
```text
-collected 25 items
+collected 27 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
@@ -105,13 +112,31 @@ cli_anything/wavetone/tests/test_core.py::test_wavetone_launch_fails_on_early_no
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_core.py::test_repl_reports_click_exit_without_unexpected_error PASSED
+cli_anything/wavetone/tests/test_full_e2e.py::test_real_backend_requires_explicit_opt_in PASSED
cli_anything/wavetone/tests/test_full_e2e.py::TestCLISubprocess::test_help PASSED
cli_anything/wavetone/tests/test_full_e2e.py::TestCLISubprocess::test_project_audio_workflow_json PASSED
cli_anything/wavetone/tests/test_full_e2e.py::TestCLISubprocess::test_formats_json PASSED
-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
+cli_anything/wavetone/tests/test_full_e2e.py::TestRealWaveToneBackend::test_doctor_real_backend SKIPPED
+cli_anything/wavetone/tests/test_full_e2e.py::TestRealWaveToneBackend::test_launch_real_backend_with_wav SKIPPED
-25 passed in 3.32s
+25 passed, 2 skipped in 1.83s
+```
+
+Real backend opt-in command:
+
+```bash
+$env:PATH = "$env:APPDATA\Python\Python313\Scripts;$env:PATH"
+$env:CLI_ANYTHING_WAVETONE_REAL_BACKEND = "1"
+$env:WAVETONE_HOME = "C:\Users\Hp\Desktop\wavetone2.6.1"
+Remove-Item Env:WAVETONE_EXE -ErrorAction SilentlyContinue
+python -m pytest cli_anything\wavetone\tests\ -v -s
+```
+
+Real backend result:
+
+```text
+27 passed in 3.56s
```
## Coverage Notes
@@ -122,13 +147,15 @@ cli_anything/wavetone/tests/test_full_e2e.py::TestRealWaveToneBackend::test_laun
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, launch runtime
- error reporting, Windows launch gating, and REPL Windows path splitting.
+ error reporting, Windows launch gating, REPL Windows path splitting, and
+ REPL Click exit handling.
- 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`
with a generated WAV and terminates it after a short wait.
-- Real backend tests are skipped automatically when Windows or a ready WaveTone
- extraction is unavailable.
+- Real backend tests are skipped by default unless
+ `CLI_ANYTHING_WAVETONE_REAL_BACKEND=1` and `WAVETONE_EXE` or `WAVETONE_HOME`
+ are set.
- WaveTone 2.61 has no documented headless analysis/export API. Export
verification remains a known gap until a stable non-GUI automation surface is
discovered.
diff --git a/wavetone/agent-harness/cli_anything/wavetone/tests/test_core.py b/wavetone/agent-harness/cli_anything/wavetone/tests/test_core.py
index e816fe913..522f8ef28 100644
--- a/wavetone/agent-harness/cli_anything/wavetone/tests/test_core.py
+++ b/wavetone/agent-harness/cli_anything/wavetone/tests/test_core.py
@@ -4,9 +4,11 @@ import json
import subprocess
from pathlib import Path
+import click
import pytest
from click.testing import CliRunner
+from cli_anything.wavetone import wavetone_cli as cli_module
from cli_anything.wavetone.core import audio as audio_core
from cli_anything.wavetone.core.audio import probe_audio
from cli_anything.wavetone.core.project import (
@@ -312,3 +314,42 @@ def test_repl_split_strips_windows_quotes() -> None:
"-o",
"C:\\Users\\me\\song.wt.json",
]
+
+
+def test_repl_reports_click_exit_without_unexpected_error(monkeypatch: pytest.MonkeyPatch) -> None:
+ errors: list[str] = []
+ inputs = iter(["wavetone launch", "exit"])
+
+ class FakeSkin:
+ def __init__(self, name: str, version: str) -> None:
+ self.name = name
+ self.version = version
+
+ def print_banner(self) -> None:
+ return None
+
+ def info(self, message: str) -> None:
+ return None
+
+ def create_prompt_session(self) -> object:
+ return object()
+
+ def get_input(self, prompt_session: object, project_name: str, modified: bool) -> str:
+ return next(inputs)
+
+ def error(self, message: str) -> None:
+ errors.append(message)
+
+ def print_goodbye(self) -> None:
+ return None
+
+ def fake_main(**kwargs: object) -> None:
+ raise click.exceptions.Exit(1)
+
+ monkeypatch.setattr(cli_module, "ReplSkin", FakeSkin)
+ monkeypatch.setattr(cli_module.cli, "main", fake_main)
+
+ result = CliRunner().invoke(cli_module.repl, [], obj={"json": False})
+
+ assert result.exit_code == 0, result.output
+ assert errors == ["Command exited with code 1"]
diff --git a/wavetone/agent-harness/cli_anything/wavetone/tests/test_full_e2e.py b/wavetone/agent-harness/cli_anything/wavetone/tests/test_full_e2e.py
index 695840fcf..ae28a5592 100644
--- a/wavetone/agent-harness/cli_anything/wavetone/tests/test_full_e2e.py
+++ b/wavetone/agent-harness/cli_anything/wavetone/tests/test_full_e2e.py
@@ -12,6 +12,8 @@ import pytest
from cli_anything.wavetone.tests.helpers import make_wav
from cli_anything.wavetone.utils import wavetone_backend
+REAL_BACKEND_ENV = "CLI_ANYTHING_WAVETONE_REAL_BACKEND"
+
def _resolve_cli(name: str) -> list[str]:
"""Resolve installed CLI command; fall back to python -m for development."""
@@ -27,9 +29,17 @@ def _resolve_cli(name: str) -> list[str]:
return [sys.executable, "-m", module]
+def _env_flag_enabled(name: str) -> bool:
+ return os.environ.get(name, "").strip().lower() in {"1", "true", "yes", "on"}
+
+
def _real_backend_ready() -> tuple[bool, str]:
+ if not _env_flag_enabled(REAL_BACKEND_ENV):
+ return False, f"set {REAL_BACKEND_ENV}=1 with WAVETONE_EXE or WAVETONE_HOME to run real backend tests"
if sys.platform != "win32":
return False, "WaveTone real-backend tests require Windows"
+ if not (os.environ.get("WAVETONE_EXE") or os.environ.get("WAVETONE_HOME")):
+ return False, "set WAVETONE_EXE or WAVETONE_HOME to run real backend tests"
status = wavetone_backend.doctor()
if status.get("ready"):
@@ -43,6 +53,17 @@ def _real_backend_ready() -> tuple[bool, str]:
_REAL_BACKEND_READY, _REAL_BACKEND_SKIP_REASON = _real_backend_ready()
+def test_real_backend_requires_explicit_opt_in(monkeypatch: pytest.MonkeyPatch) -> None:
+ monkeypatch.delenv(REAL_BACKEND_ENV, raising=False)
+ monkeypatch.delenv("WAVETONE_EXE", raising=False)
+ monkeypatch.delenv("WAVETONE_HOME", raising=False)
+
+ ready, reason = _real_backend_ready()
+
+ assert ready is False
+ assert REAL_BACKEND_ENV in reason
+
+
class TestCLISubprocess:
CLI_BASE = _resolve_cli("cli-anything-wavetone")