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.

fix(test): bound the atomic-io reader and fail fast on a missing async plugin

cyh20929c93d5b3
diff --git a/pyproject.toml b/pyproject.toml
index a88fb415a..4e534e2fd 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -157,6 +157,12 @@ extend-ignore = ["E501"]
[tool.pytest.ini_options]
asyncio_mode = "auto"
+# Without pytest-asyncio every ``async def`` test fails individually with
+# "async def functions are not natively supported", and ``asyncio_mode`` above
+# is reported only as an unknown-config warning. That names the tests instead of
+# the missing plugin, so a suite run in an environment that never installed the
+# dev group looks like a broad product regression. Fail once, up front, instead.
+required_plugins = ["pytest-asyncio"]
markers = [
"e2e_model_hub: opt-in hermetic Model Hub HTTP and gateway scenarios",
"integration: tests excluded from the unit shards because they need external infrastructure (Docker + platform tokens) or minutes of real filesystem work",
diff --git a/tests/test_atomic_io.py b/tests/test_atomic_io.py
index 978edb501..64d443ab5 100644
--- a/tests/test_atomic_io.py
+++ b/tests/test_atomic_io.py
@@ -92,7 +92,15 @@ def test_concurrent_writers_publish_whole_payloads_never_fragments(tmp_path) ->
target = tmp_path / "status.json"
payloads = [json.dumps({"writer": index, "filler": "x" * 40_000}) for index in range(8)]
whole = set(payloads)
- observed: list[str] = []
+ # A set, not a list: no assertion below reads how *many* times the reader got
+ # through, only which distinct payloads it saw. Keeping every read instead
+ # ties this test's memory to how slow the disk is -- the reader spins until
+ # the writers finish, so a slower filesystem buys more 40KB strings, and the
+ # resulting paging slows the writers it is waiting on. That feedback loop
+ # measured 3.5GB RSS and 216s on an IO-constrained container against the 1s
+ # this file records on CI. Deduplicating keeps it bounded by the payload set
+ # and loses nothing: a torn read is a value outside ``whole`` either way.
+ observed: set[str] = set()
stop = threading.Event()
def _write(payload: str) -> None:
@@ -102,7 +110,7 @@ def test_concurrent_writers_publish_whole_payloads_never_fragments(tmp_path) ->
def _read() -> None:
while not stop.is_set():
try:
- observed.append(target.read_text(encoding="utf-8"))
+ observed.add(target.read_text(encoding="utf-8"))
except FileNotFoundError:
continue
@@ -118,7 +126,7 @@ def test_concurrent_writers_publish_whole_payloads_never_fragments(tmp_path) ->
assert target.read_text(encoding="utf-8") in whole
assert observed, "reader never managed to observe the file"
- assert set(observed) <= whole
+ assert observed <= whole
assert list(tmp_path.glob(f".{target.name}.*")) == []