Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

test(regression): harden full-suite leftovers (#633)

Call White43a7b557dd88
diff --git a/tests/test_install_script.py b/tests/test_install_script.py
index 4834caf87..d587d4e42 100644
--- a/tests/test_install_script.py
+++ b/tests/test_install_script.py
@@ -78,6 +78,16 @@ def _write_fake_node(path: Path, version: str = "v22.16.0") -> None:
)
+def _write_missing_node(path: Path) -> None:
+ _write_executable(
+ path,
+ """\
+ #!/usr/bin/env bash
+ exit 127
+ """,
+ )
+
+
def _write_fake_file(path: Path, mapping: dict[Path, str]) -> None:
cases = "\n".join(
f' "{target}") echo "${{prefix}}{description}" ;;' for target, description in mapping.items()
@@ -174,6 +184,7 @@ def test_install_script_installs_node_when_missing(tmp_path):
uv_log = tmp_path / "uv-tool-bin-dir.txt"
_write_fake_uv(path_dir / "uv", uv_log)
+ _write_missing_node(path_dir / "node")
_write_fake_uname(path_dir / "uname", machine="arm64")
_write_executable(
path_dir / "brew",
@@ -263,6 +274,7 @@ def test_install_script_continues_when_node_install_fails(tmp_path):
uv_log = tmp_path / "uv-tool-bin-dir.txt"
_write_fake_uv(path_dir / "uv", uv_log)
+ _write_missing_node(path_dir / "node")
_write_fake_uname(path_dir / "uname", machine="arm64")
_write_executable(
path_dir / "brew",
diff --git a/tests/test_sse_broker.py b/tests/test_sse_broker.py
index 9d7358b07..d9749bfcf 100644
--- a/tests/test_sse_broker.py
+++ b/tests/test_sse_broker.py
@@ -11,6 +11,7 @@ take down whichever caller was publishing the event. The lock added to
from __future__ import annotations
import asyncio
+import concurrent.futures
import json
import sys
import threading
@@ -69,10 +70,16 @@ def test_publish_survives_concurrent_subscribe_churn():
runner = threading.Thread(target=_runner, daemon=True)
runner.start()
- async def _seed_initial_subscriber():
- broker.subscribe()
+ async def _seed_loop():
+ return broker.subscribe()
- asyncio.run_coroutine_threadsafe(_seed_initial_subscriber(), loop).result(timeout=5)
+ stable_sub_id, stable_queue = asyncio.run_coroutine_threadsafe(_seed_loop(), loop).result(timeout=5)
+
+ async def _drain_stable_subscriber() -> None:
+ while True:
+ await stable_queue.get()
+
+ drain = asyncio.run_coroutine_threadsafe(_drain_stable_subscriber(), loop)
stop = threading.Event()
errors: list[BaseException] = []
@@ -97,13 +104,24 @@ def test_publish_survives_concurrent_subscribe_churn():
broker.unsubscribe(sub_id)
await asyncio.sleep(0)
- asyncio.run_coroutine_threadsafe(_churn(), loop).result(timeout=15)
+ async def _unsubscribe(sub_id: int) -> None:
+ broker.unsubscribe(sub_id)
+
+ try:
+ asyncio.run_coroutine_threadsafe(_churn(), loop).result(timeout=15)
+ finally:
+ stop.set()
+ publisher.join(timeout=5)
- stop.set()
- publisher.join(timeout=5)
+ drain.cancel()
+ try:
+ drain.result(timeout=5)
+ except concurrent.futures.CancelledError:
+ pass
- loop.call_soon_threadsafe(loop.stop)
- runner.join(timeout=5)
- loop.close()
+ asyncio.run_coroutine_threadsafe(_unsubscribe(stable_sub_id), loop).result(timeout=5)
+ loop.call_soon_threadsafe(loop.stop)
+ runner.join(timeout=5)
+ loop.close()
assert not errors, f"publish() raised under concurrent churn: {errors!r}"