test(hermes_cli): make test_default_path pass on native Windows

TestGetHermesHome.test_default_path asserted ~/.hermes unconditionally,
but the native Windows default is %LOCALAPPDATA%\hermes (see
hermes_constants._get_platform_default_hermes_home). Branch the
assertion by platform so the test passes everywhere.

Salvaged from PR #96003 by @Aoshi-Dev (the parse-guard half of that PR
was superseded by #96169); authorship preserved.
This commit is contained in:
Aoshi-Dev
2026-08-27 13:56:47 +05:30
committed by kshitij
parent 93a29d110d
commit 5ab04c764c
+13 -1
View File
@@ -1,6 +1,7 @@
"""Tests for hermes_cli configuration management."""
import os
import sys
from pathlib import Path
from unittest.mock import patch
@@ -37,7 +38,18 @@ class TestGetHermesHome:
with patch.dict(os.environ, {}, clear=False):
os.environ.pop("HERMES_HOME", None)
home = get_hermes_home()
assert home == Path.home() / ".hermes"
if sys.platform == "win32":
# Windows default is %LOCALAPPDATA%\hermes — see
# hermes_constants._get_platform_default_hermes_home.
local_appdata = os.environ.get("LOCALAPPDATA", "").strip()
base = (
Path(local_appdata)
if local_appdata
else Path.home() / "AppData" / "Local"
)
assert home == base / "hermes"
else:
assert home == Path.home() / ".hermes"
class TestEnsureHermesHome: