@@ -890,3 +890,51 @@ def test_add_repo_no_merge_preserves_duplicate_sections(
890890 expected_repos = set (expected_original_repos ) | {new_repo_name }
891891 assert combined_repos == expected_repos , f"{ test_id } : repositories mismatch"
892892 assert contains_new_repo , f"{ test_id } : new repo missing from duplicate sections"
893+
894+
895+ @pytest .mark .xfail (
896+ reason = (
897+ "vcspull add run from the workspace root labels the workspace as './' "
898+ "instead of the expected '~/…/' path"
899+ ),
900+ )
901+ def test_handle_add_command_workspace_label_from_workspace_root (
902+ tmp_path : pathlib .Path ,
903+ monkeypatch : MonkeyPatch ,
904+ caplog : t .Any ,
905+ ) -> None :
906+ """CLI add should label workspace roots with their tilde path even from root cwd."""
907+ caplog .set_level (logging .INFO )
908+
909+ monkeypatch .setenv ("HOME" , str (tmp_path ))
910+
911+ workspace_root = tmp_path / "study/python"
912+ repo_path = workspace_root / "pytest-docker"
913+ init_git_repo (repo_path , remote_url = "https://github.com/avast/pytest-docker" )
914+
915+ monkeypatch .chdir (workspace_root )
916+
917+ config_file = tmp_path / ".vcspull.yaml"
918+
919+ args = argparse .Namespace (
920+ repo_path = str (repo_path ),
921+ url = None ,
922+ override_name = None ,
923+ config = str (config_file ),
924+ workspace_root_path = None ,
925+ dry_run = False ,
926+ assume_yes = True ,
927+ merge_duplicates = True ,
928+ )
929+
930+ handle_add_command (args )
931+
932+ expected_label = "~/study/python/"
933+ assert expected_label in caplog .text
934+
935+ import yaml
936+
937+ with config_file .open (encoding = "utf-8" ) as fh :
938+ config_data = yaml .safe_load (fh )
939+
940+ assert expected_label in config_data
0 commit comments