Skip to content

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

Python

fix: address WaveTone harness review feedback

Shuhan Zhangc2ca6cfe5a80
diff --git a/wavetone/agent-harness/cli_anything/wavetone/README.md b/wavetone/agent-harness/cli_anything/wavetone/README.md
index 8f30b1c42..de0f9f08f 100644
--- a/wavetone/agent-harness/cli_anything/wavetone/README.md
+++ b/wavetone/agent-harness/cli_anything/wavetone/README.md
@@ -53,4 +53,6 @@ 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.
+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.
diff --git a/wavetone/agent-harness/cli_anything/wavetone/tests/TEST.md b/wavetone/agent-harness/cli_anything/wavetone/tests/TEST.md
index 138f49968..070375ab2 100644
--- a/wavetone/agent-harness/cli_anything/wavetone/tests/TEST.md
+++ b/wavetone/agent-harness/cli_anything/wavetone/tests/TEST.md
@@ -84,7 +84,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
-13 passed in 4.64s
+13 passed in 3.35s
```
## Coverage Notes
@@ -95,6 +95,8 @@ cli_anything/wavetone/tests/test_full_e2e.py::TestRealWaveToneBackend::test_laun
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.
- 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_full_e2e.py b/wavetone/agent-harness/cli_anything/wavetone/tests/test_full_e2e.py
index 436856efe..c3040df3f 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
@@ -10,6 +10,8 @@ import sys
import wave
from pathlib import Path
+import pytest
+
from cli_anything.wavetone.utils import wavetone_backend
@@ -39,6 +41,22 @@ def _resolve_cli(name: str) -> list[str]:
return [sys.executable, "-m", module]
+def _real_backend_ready() -> tuple[bool, str]:
+ if sys.platform != "win32":
+ return False, "WaveTone real-backend tests require Windows"
+
+ status = wavetone_backend.doctor()
+ if status.get("ready"):
+ return True, ""
+
+ failed_checks = [check["name"] for check in status.get("checks", []) if not check.get("ok")]
+ reason = ", ".join(failed_checks) if failed_checks else "WaveTone backend is not ready"
+ return False, f"WaveTone real backend unavailable: {reason}"
+
+
+_REAL_BACKEND_READY, _REAL_BACKEND_SKIP_REASON = _real_backend_ready()
+
+
class TestCLISubprocess:
CLI_BASE = _resolve_cli("cli-anything-wavetone")
@@ -80,6 +98,7 @@ class TestCLISubprocess:
assert "MP3" in data["formats"]["from_readme"]
[email protected](not _REAL_BACKEND_READY, reason=_REAL_BACKEND_SKIP_REASON)
class TestRealWaveToneBackend:
CLI_BASE = _resolve_cli("cli-anything-wavetone")
diff --git a/wavetone/agent-harness/cli_anything/wavetone/utils/repl_skin.py b/wavetone/agent-harness/cli_anything/wavetone/utils/repl_skin.py
index bc1fb6d1d..a1d4e27da 100644
--- a/wavetone/agent-harness/cli_anything/wavetone/utils/repl_skin.py
+++ b/wavetone/agent-harness/cli_anything/wavetone/utils/repl_skin.py
@@ -447,7 +447,7 @@ class ReplSkin:
# Separator
sep_parts = [self._c(_DARK_GRAY, _H_LINE * w) for w in col_widths]
- sep_line = self._c(_DARK_GRAY, f" {'───'.join([_H_LINE * w for w in col_widths])}")
+ sep_line = f" {sep.join(sep_parts)}"
print(sep_line)
# Rows
diff --git a/wavetone/agent-harness/cli_anything/wavetone/utils/wavetone_backend.py b/wavetone/agent-harness/cli_anything/wavetone/utils/wavetone_backend.py
index d0fdbdea3..076fbe4d2 100644
--- a/wavetone/agent-harness/cli_anything/wavetone/utils/wavetone_backend.py
+++ b/wavetone/agent-harness/cli_anything/wavetone/utils/wavetone_backend.py
@@ -113,8 +113,9 @@ def launch_wavetone(
process = subprocess.Popen(args, cwd=str(exe.parent))
if wait_seconds > 0:
time.sleep(wait_seconds)
- running_after_wait = process.poll() is None
- exit_code = process.poll()
+ polled = process.poll()
+ running_after_wait = polled is None
+ exit_code = polled
terminated = False
if terminate and running_after_wait:
process.terminate()
diff --git a/wavetone/agent-harness/cli_anything/wavetone/wavetone_cli.py b/wavetone/agent-harness/cli_anything/wavetone/wavetone_cli.py
index 9ca90f51f..3a0edf649 100644
--- a/wavetone/agent-harness/cli_anything/wavetone/wavetone_cli.py
+++ b/wavetone/agent-harness/cli_anything/wavetone/wavetone_cli.py
@@ -93,8 +93,13 @@ def repl(ctx: click.Context) -> None:
try:
args = shlex.split(line, posix=(os.name != "nt"))
cli.main(args=args, prog_name="cli-anything-wavetone", standalone_mode=False, obj=ctx.obj)
+ except click.ClickException as exc: # pragma: no cover
+ skin.error(exc.format_message())
+ except click.exceptions.Exit as exc: # pragma: no cover
+ if exc.exit_code not in (0, None):
+ skin.error(f"Command exited with code {exc.exit_code}")
except Exception as exc: # pragma: no cover
- skin.error(str(exc))
+ skin.error(f"Unexpected error: {exc}")
skin.print_goodbye()