From ae1c52e43bd196b9673da169ae31c50fc9fb212c Mon Sep 17 00:00:00 2001 From: Arnold Wender Date: Fri, 24 Apr 2026 11:20:30 +0200 Subject: [PATCH] test(config): drop tilde-absence assertion for Windows 8.3 compatibility Windows 8.3 short paths legitimately contain tildes (e.g. the CI runner's USERPROFILE resolves to C:\Users\RUNNER~1\...), so asserting "~" is absent from the expanded path fails on Windows even when expanduser worked correctly. The equality check against os.path.abspath(os.path.expanduser()) is authoritative; drop the redundant absence heuristic. --- tests/test_config.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/test_config.py b/tests/test_config.py index 9200214..824f6a8 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -34,11 +34,14 @@ def test_env_override(): def test_env_path_expanduser(): + # Tilde must be expanded to match the --palace CLI code path. We don't + # assert "~" is absent from the final string because Windows 8.3 short + # paths (e.g. C:\Users\RUNNER~1\...) legitimately contain tildes — the + # equality check is authoritative. raw = os.path.join("~", "mempalace-test") os.environ["MEMPALACE_PALACE_PATH"] = raw try: cfg = MempalaceConfig(config_dir=tempfile.mkdtemp()) - # Tilde must be expanded to match the --palace CLI code path. assert cfg.palace_path == os.path.abspath(os.path.expanduser(raw)) assert cfg.palace_path.endswith("mempalace-test") finally: @@ -61,13 +64,15 @@ def test_env_path_abspath_collapses_traversal(): def test_env_path_legacy_alias_normalized(): - # Legacy MEMPAL_PALACE_PATH gets the same normalization treatment. + # Legacy MEMPAL_PALACE_PATH gets the same normalization treatment as + # MEMPALACE_PALACE_PATH. We don't assert "~" is absent from the final + # string because Windows 8.3 short paths (e.g. C:\Users\RUNNER~1\...) + # legitimately contain tildes — the equality check below is authoritative. os.environ.pop("MEMPALACE_PALACE_PATH", None) raw = os.path.join("~", "legacy-alias", "..", "mempalace-test") os.environ["MEMPAL_PALACE_PATH"] = raw try: cfg = MempalaceConfig(config_dir=tempfile.mkdtemp()) - assert "~" not in cfg.palace_path assert ".." not in cfg.palace_path assert cfg.palace_path == os.path.abspath(os.path.expanduser(raw)) finally: