Skip to content

Commit a6eb38e

Browse files
committed
Prefer Ladybug root over nested dataset dir
1 parent b798c9d commit a6eb38e

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

test/lbug_test_paths.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
def _resolve_lbug_root(anchor: Path | None = None) -> Path:
88
repo_root = (anchor or _REPO_ROOT).resolve()
99
for candidate in (repo_root, *repo_root.parents):
10-
if (candidate / "dataset").is_dir():
11-
return candidate
1210
if candidate.name == "python_api" and candidate.parent.name == "tools":
1311
return candidate.parent.parent
12+
if (candidate / "dataset").is_dir():
13+
return candidate
1414
if (candidate / "ladybug" / "dataset").is_dir():
1515
return candidate / "ladybug"
1616
return repo_root

test/test_test_helper.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,13 @@ def test_nested_ci_checkout_dataset_path_is_outside_python_api_tree() -> None:
2424
assert dataset_root.as_posix().endswith(
2525
"/ladybug-python/ladybug-python/ladybug/dataset"
2626
)
27+
28+
29+
def test_nested_ci_checkout_prefers_parent_ladybug_root_over_local_dataset_dir() -> None:
30+
repo_root = Path(
31+
"/home/runner/work/ladybug-python/ladybug-python/ladybug/tools/python_api"
32+
)
33+
34+
resolved = _resolve_lbug_root(repo_root)
35+
assert resolved.name == "ladybug"
36+
assert "/tools/python_api" not in resolved.as_posix()

0 commit comments

Comments
 (0)