From 9ea35ca8cbb2a92db813ed860cd2181643c7791f Mon Sep 17 00:00:00 2001 From: jubaoliang Date: Tue, 25 Aug 2026 08:35:43 +0000 Subject: [PATCH 1/2] fix(tests): align subagent catalog division count with bundled library The bundled subagent catalog now loads 19 divisions (272 agents), but two tests still hard-coded an expected count of 16. Update the assertions so the pre-commit suite is green. --- tests/integration/test_subagents_api.py | 2 +- tests/unit/agents/test_subagent_catalog.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/test_subagents_api.py b/tests/integration/test_subagents_api.py index 5bc8d4da..53c4deea 100644 --- a/tests/integration/test_subagents_api.py +++ b/tests/integration/test_subagents_api.py @@ -103,7 +103,7 @@ async def test_catalog_divisions(env: Any) -> None: r = await c.get("/api/subagent-catalog/divisions", headers=auth) assert r.status_code == 200, r.text rows = r.json() - assert len(rows) == 16 + assert len(rows) == 19 assert any(row["id"] == "engineering" and row["count"] > 0 for row in rows) diff --git a/tests/unit/agents/test_subagent_catalog.py b/tests/unit/agents/test_subagent_catalog.py index 3b3f2a49..06871fb3 100644 --- a/tests/unit/agents/test_subagent_catalog.py +++ b/tests/unit/agents/test_subagent_catalog.py @@ -192,7 +192,7 @@ def test_bundled_library_non_empty() -> None: catalog = SubagentCatalog(default_package_root()) catalog.refresh() assert len(catalog.list_summaries()) > 100 - assert len(catalog.list_divisions()) == 16 + assert len(catalog.list_divisions()) == 19 assert catalog.get("engineering-software-architect") is not None From ddddff9c25818d5b5296c4cb9abc1489abf4d5b7 Mon Sep 17 00:00:00 2001 From: jubaoliang Date: Tue, 25 Aug 2026 12:02:54 +0000 Subject: [PATCH 2/2] fix(tests): allow monkeypatching absent os.getuid on Windows monkeypatch.setattr(..., raising=True) fails when getuid is missing on Windows; use raising=False so the USERNAME fallback path is covered. Co-authored-by: Cursor --- tests/unit/browser/test_browser_setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit/browser/test_browser_setup.py b/tests/unit/browser/test_browser_setup.py index e8c9d056..fd721136 100644 --- a/tests/unit/browser/test_browser_setup.py +++ b/tests/unit/browser/test_browser_setup.py @@ -150,7 +150,8 @@ def test_temp_scope_token_uses_username_when_getuid_missing( from octop.infra.browser import setup as browser_setup # Simulate Windows: getuid absent / not callable. - monkeypatch.setattr(browser_setup.os, "getuid", object()) + # raising=False: Windows os has no getuid (frozen module AttributeError otherwise). + monkeypatch.setattr(browser_setup.os, "getuid", object(), raising=False) monkeypatch.setenv("USERNAME", "OctopUser") monkeypatch.delenv("USER", raising=False)