Skip to content

Commit 66b093e

Browse files
committed
tests/discover(add[xfail]): reproduce user-level workspace bug (#487)
1 parent a40ceaa commit 66b093e

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

tests/cli/test_discover.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,64 @@ def _fake_save(path: pathlib.Path, data: dict[str, t.Any]) -> None:
698698
assert "Successfully updated" in caplog.text
699699

700700

701+
@pytest.mark.xfail(reason="discover uses ./ for user-level configs (#487)", strict=True)
702+
def test_discover_user_config_prefers_absolute_workspace_label(
703+
tmp_path: pathlib.Path,
704+
monkeypatch: MonkeyPatch,
705+
caplog: t.Any,
706+
) -> None:
707+
import logging
708+
import yaml
709+
710+
caplog.set_level(logging.INFO)
711+
712+
home = tmp_path
713+
monkeypatch.setenv("HOME", str(home))
714+
715+
scan_dir = home / "study" / "golang"
716+
scan_dir.mkdir(parents=True)
717+
monkeypatch.chdir(scan_dir)
718+
719+
init_git_repo(scan_dir / "moby", "git+https://github.com/moby/moby.git")
720+
init_git_repo(
721+
scan_dir / "typescript-go",
722+
"git+https://github.com/microsoft/typescript-go.git",
723+
)
724+
725+
config_file = home / ".vcspull.yaml"
726+
config_file.write_text(
727+
yaml.dump(
728+
{
729+
"~/study/ai-agents/": {
730+
"aider": {
731+
"repo": "[email protected]:Aider-AI/aider.git",
732+
},
733+
},
734+
},
735+
),
736+
encoding="utf-8",
737+
)
738+
739+
discover_repos(
740+
scan_dir_str=str(scan_dir),
741+
config_file_path_str=None,
742+
recursive=False,
743+
workspace_root_override=None,
744+
yes=True,
745+
dry_run=False,
746+
)
747+
748+
assert "Successfully updated ~/.vcspull.yaml" in caplog.text
749+
750+
with config_file.open(encoding="utf-8") as fh:
751+
config_data = yaml.safe_load(fh)
752+
753+
assert config_data is not None
754+
assert "~/study/golang/" in config_data
755+
assert "./" not in config_data
756+
assert set(config_data["~/study/golang/"]) == {"moby", "typescript-go"}
757+
758+
701759
@pytest.mark.parametrize(
702760
list(DiscoverInvalidWorkspaceFixture._fields),
703761
DISCOVER_INVALID_WORKSPACE_FIXTURES,

0 commit comments

Comments
 (0)