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.
This commit is contained in:
+17
-3
@@ -54,16 +54,30 @@ def _resolve_registry_root() -> Path:
|
|||||||
(Desktop/apps/graph_explorer/tests) NO hay registry — usamos el
|
(Desktop/apps/graph_explorer/tests) NO hay registry — usamos el
|
||||||
propio app dir como fallback. Los tests no leen registry.db; solo
|
propio app dir como fallback. Los tests no leen registry.db; solo
|
||||||
se pasa registry_root via ctx por compatibilidad con run.py.
|
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
|
p = APP_DIR_SRC
|
||||||
for _ in range(8):
|
for _ in range(8):
|
||||||
if (p / "cmd" / "fn" / "main.go").exists() or \
|
if (p / "cmd" / "fn" / "main.go").exists():
|
||||||
(p / "registry.db").exists():
|
|
||||||
return p
|
return p
|
||||||
if p.parent == p:
|
if p.parent == p:
|
||||||
break
|
break
|
||||||
p = p.parent
|
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
|
# Sin registry: usa el app dir como pseudo-root. Los tests funcionan
|
||||||
# igual mientras no haya un test que importe paquetes del registry.
|
# igual mientras no haya un test que importe paquetes del registry.
|
||||||
return APP_DIR_SRC
|
return APP_DIR_SRC
|
||||||
|
|||||||
Reference in New Issue
Block a user