Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

test(explorer): expand nested routers when collecting app routes

administratorab148a9c6d8e
diff --git a/tests/explorer/test_explorer_entrypoints.py b/tests/explorer/test_explorer_entrypoints.py
index dd273dd8..fdfa0e91 100644
--- a/tests/explorer/test_explorer_entrypoints.py
+++ b/tests/explorer/test_explorer_entrypoints.py
@@ -96,7 +96,18 @@ def test_legacy_server_mounts_editable_markdown_routes(monkeypatch):
from semantica import server
- paths = {route.path for route in server.app.routes}
+ # fastapi>=0.141 nests included routers in app.routes as _IncludedRouter
+ # entries whose own routes only appear via original_router — expand them
+ # so mounted paths stay visible on every fastapi version.
+ def _iter_paths(routes):
+ for route in routes:
+ nested = getattr(route, "original_router", None)
+ if nested is not None:
+ yield from _iter_paths(nested.routes)
+ elif hasattr(route, "path"):
+ yield route.path
+
+ paths = set(_iter_paths(server.app.routes))
assert "/api/markdown/{kind}/{resource_id:path}" in paths
assert "/api/memories" in paths
assert "/ws/graph-updates" in paths