Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

test: pin the platform in the pet-shortcut and accelerator-source tests (#519)

Ruben Lütkeb830f05eaa32
diff --git a/tests/unit/hardware/test_accelerator_probe.py b/tests/unit/hardware/test_accelerator_probe.py
index dec1cab3ee..de5cf2522d 100644
--- a/tests/unit/hardware/test_accelerator_probe.py
+++ b/tests/unit/hardware/test_accelerator_probe.py
@@ -30,6 +30,13 @@ def _no_nvidia(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(detection, "_detect_nvidia_gpus", lambda: [])
+def _not_a_mac(monkeypatch: pytest.MonkeyPatch) -> None:
+ """Apple Silicon answers from unified memory before any card source, so a
+ test of the card sources must not run as a Mac on a macOS runner."""
+ monkeypatch.setattr(detection.sys, "platform", "win32")
+ monkeypatch.setattr(detection.platform, "machine", lambda: "AMD64")
+
+
def _no_vendor_sources(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(detection, "_ollama_reported_gb", lambda: 0.0)
monkeypatch.setattr(detection, "_windows_registry_vram_gb", lambda: 0.0)
@@ -141,6 +148,7 @@ def test_an_amd_card_is_read_where_nvidia_smi_sees_nothing(
"""The defect this source exists for: a 16 GB Radeon used to report 0, and
every fit verdict fell back to the system-RAM rule."""
_no_nvidia(monkeypatch)
+ _not_a_mac(monkeypatch)
monkeypatch.setattr(detection, "_ollama_reported_gb", lambda: 16.0)
assert detection.usable_accelerator_gb() == (16.0, "ollama-runtime")
@@ -152,6 +160,7 @@ def test_the_os_inventory_answers_when_no_server_has_run(
before anything is downloaded. Patched at the source-selection seam so the
assertion holds on whichever OS runs the suite."""
_no_nvidia(monkeypatch)
+ _not_a_mac(monkeypatch)
monkeypatch.setattr(detection, "_vendor_neutral_gb", lambda: (12.0, "windows-registry"))
assert detection.usable_accelerator_gb() == (12.0, "windows-registry")
diff --git a/tests/unit/harness/test_cu_loop_robustness.py b/tests/unit/harness/test_cu_loop_robustness.py
index bdb40f3e58..dbfcff49a4 100644
--- a/tests/unit/harness/test_cu_loop_robustness.py
+++ b/tests/unit/harness/test_cu_loop_robustness.py
@@ -1027,7 +1027,7 @@ async def test_progress_announcement_does_not_block_the_loop() -> None:
plan_script=[_CHROME_PLAN],
judge_script=['{"done": true, "proof": "ok"}'],
)
- bus = SlowAnnouncementBus(block_s=0.75)
+ bus = SlowAnnouncementBus(block_s=5.0)
ctx = make_ctx(brain, verify=True, bus=bus, announce_progress=True)
start = time.monotonic()
@@ -1037,8 +1037,8 @@ async def test_progress_announcement_does_not_block_the_loop() -> None:
assert chunks[-1].exit_code == 0
# With the old blocking publish, the single announced state change costs
# >= block_s on the loop's own wall clock. Non-blocking must stay well
- # under one block interval.
- assert elapsed < 0.5, f"loop blocked on announcement publish ({elapsed:.2f}s)"
+ # under one block interval; the gap leaves room for a slow CI runner.
+ assert elapsed < 3.0, f"loop blocked on announcement publish ({elapsed:.2f}s)"
# The announcement must still go out (fire-and-forget, not dropped).
pending = set(getattr(loop_mod, "_ANNOUNCE_TASKS", set()))
diff --git a/tests/unit/ui/test_pet_right_click.py b/tests/unit/ui/test_pet_right_click.py
index 2c33be46a1..6cdab35869 100644
--- a/tests/unit/ui/test_pet_right_click.py
+++ b/tests/unit/ui/test_pet_right_click.py
@@ -212,11 +212,17 @@ def test_failed_popup_releases_grab_without_hiding_pet(pet, monkeypatch, caplog)
@pytest.mark.parametrize("language", context_menu.LABELS)
-def test_menu_reads_current_language_and_explicit_shortcut(tmp_path, language) -> None:
+def test_menu_reads_current_language_and_explicit_shortcut(
+ tmp_path, monkeypatch, language
+) -> None:
config = tmp_path / "menu.toml"
config.write_text(f'[ui]\nlanguage="{language}"\n[trigger]\nhotkey_pet_toggle="ctrl+alt+p"')
+ # The shortcut is spelled with each OS's own key names.
+ monkeypatch.setattr(context_menu.sys, "platform", "win32")
labels, shortcut = context_menu.preferences(config)
assert labels == context_menu.LABELS[language]
assert shortcut == "Ctrl+Alt+P"
+ monkeypatch.setattr(context_menu.sys, "platform", "darwin")
+ assert context_menu.preferences(config)[1] == "Control+Option+P"
config.write_text('[trigger]\nhotkey_pet_toggle=""')
assert context_menu.preferences(config)[1] == ""