Skip to content

Commit 596dfad

Browse files
committed
test: make metrics_path fallback assertion Windows-safe
\`str(Path.home() / \".geno-lewm\" / \"logs\" / \"metrics.prom\")\` produces backslash-separated output on Windows, so the previous \`.endswith(\".geno-lewm/logs/metrics.prom\")\` assertion failed there. Compare path components via \`.parts\` instead; the check is identical on POSIX and works on Windows.
1 parent c3c5caa commit 596dfad

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tests/unit/test_coverage_extras.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,10 @@ def test_exporter_default_path_uses_env(monkeypatch: pytest.MonkeyPatch, tmp_pat
9393
def test_metrics_path_falls_back_to_home(monkeypatch: pytest.MonkeyPatch) -> None:
9494
monkeypatch.delenv("GENO_LEWM_LOG_DIR", raising=False)
9595
p = m.metrics_path()
96+
# Compare path components so the test holds on Windows
97+
# (backslashes) as well as POSIX (forward slashes).
9698
assert p.name == "metrics.prom"
97-
assert str(p).endswith(".geno-lewm/logs/metrics.prom")
99+
assert p.parts[-3:] == (".geno-lewm", "logs", "metrics.prom")
98100

99101

100102
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)