From 65a14749f3d99e644fca0e3349c3eecef0eb7977 Mon Sep 17 00:00:00 2001 From: Egutierrez Date: Mon, 4 May 2026 14:20:44 +0200 Subject: [PATCH] test(0035e): conftest resolver tolerante a worktrees fuera de fn_registry/ El resolver buscaba un marker 'registry.db' que falla en /home/lucas con un .db parasito (4KB, sin tabla functions). Endurecemos el marker a cmd/fn/main.go (mas estricto), anadimos override via FN_REGISTRY_ROOT y un fallback a ~/fn_registry. Sin esto los tests de vendor_script fallan al ejecutarse desde un git worktree. --- tests/conftest.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index fc0c739..bd27449 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -54,16 +54,30 @@ def _resolve_registry_root() -> Path: (Desktop/apps/graph_explorer/tests) NO hay registry — usamos el propio app dir como fallback. Los tests no leen registry.db; solo se pasa registry_root via ctx por compatibilidad con run.py. + + Override via env var `FN_REGISTRY_ROOT` para escenarios git-worktree + donde el app vive fuera del arbol normal del registry. """ - # Marker fiable: fichero `cmd/fn/main.go` o `registry.db`. + # Override explicito (util para git worktrees fuera de fn_registry/). + env = os.environ.get("FN_REGISTRY_ROOT") + if env: + ep = Path(env) + if ep.exists(): + return ep + # Marker fiable: fichero `cmd/fn/main.go` (mas estricto que registry.db + # solo, que podria ser un .db vacio que arrastra otro entorno). p = APP_DIR_SRC for _ in range(8): - if (p / "cmd" / "fn" / "main.go").exists() or \ - (p / "registry.db").exists(): + if (p / "cmd" / "fn" / "main.go").exists(): return p if p.parent == p: break p = p.parent + # Fallback: ubicaciones tipicas en el sistema del usuario cuando se + # trabaja en un worktree (ramas issue/* clonadas en ~/wt/). + for cand in (Path.home() / "fn_registry",): + if (cand / "cmd" / "fn" / "main.go").exists(): + return cand # Sin registry: usa el app dir como pseudo-root. Los tests funcionan # igual mientras no haya un test que importe paquetes del registry. return APP_DIR_SRC