Skip to content

Commit cee58b9

Browse files
committed
test(canary): isolate no-worktree fixtures from ancestor Git discovery
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
1 parent 938efb1 commit cee58b9

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

‎examples/canary/catalog-run-e2e-smoke.py‎

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
REPO_ROOT = Path(__file__).resolve().parents[2]
1414
sys.path.insert(0, str(REPO_ROOT))
1515

16-
import loopx.canary.runner as runner_module # noqa: E402
1716
from loopx.canary.runner import ( # noqa: E402
1817
build_catalog_canary_run,
1918
normalize_canary_command,
@@ -107,22 +106,24 @@ def assert_domain_checks_precede_family_checks() -> None:
107106

108107

109108
def assert_git_required_smoke_skips_without_git_worktree() -> None:
110-
original_root = runner_module.REPO_ROOT
111109
with tempfile.TemporaryDirectory() as temp_dir:
112110
temp_root = Path(temp_dir).resolve()
113111
(temp_root / "examples" / "control_plane").mkdir(parents=True)
114-
runner_module.REPO_ROOT = temp_root
115-
try:
116-
payload = build_catalog_canary_run(
117-
catalog_path=REPO_ROOT / "docs/concepts/interaction-pattern-catalog.md",
118-
profiles=["repo-architecture-budget"],
119-
max_checks_per_profile=1,
120-
check_limit=1,
121-
execute=True,
122-
timeout_seconds=10,
123-
)
124-
finally:
125-
runner_module.REPO_ROOT = original_root
112+
# TMPDIR may be inside a checkout. A bare repository stops Git's
113+
# ancestor discovery without providing a worktree to the check.
114+
subprocess.run(
115+
["git", "init", "--bare", "--quiet", str(temp_root)], check=True,
116+
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
117+
)
118+
payload = build_catalog_canary_run(
119+
catalog_path=REPO_ROOT / "docs/concepts/interaction-pattern-catalog.md",
120+
profiles=["repo-architecture-budget"],
121+
max_checks_per_profile=1,
122+
check_limit=1,
123+
execute=True,
124+
timeout_seconds=10,
125+
repo_root=temp_root,
126+
)
126127

127128
assert payload["ok"] is True, payload
128129
assert payload["failure_count"] == 0, payload

0 commit comments

Comments
 (0)