Skip to content

fix(test): harden test_linux_uses_dot_config against Windows CI tmp_path#3

Merged
XeonNAS merged 1 commit intomainfrom
fix/windows-ci-linux-path-test
Apr 7, 2026
Merged

fix(test): harden test_linux_uses_dot_config against Windows CI tmp_path#3
XeonNAS merged 1 commit intomainfrom
fix/windows-ci-linux-path-test

Conversation

@XeonNAS
Copy link
Copy Markdown
Owner

@XeonNAS XeonNAS commented Apr 7, 2026

Problem

test_linux_uses_dot_config was failing on the test-windows CI job with:

AssertionError: assert 'AppData' not in
'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\pytest-of-runneradmin\\pytest-0\\
test_linux_uses_dot_config0\\.config\\agileforecasting'

The production code was correct. The path correctly ended in
.config\agileforecasting, but the assertion "AppData" not in str(paths.config_dir)
checked the full absolute path string. On Windows CI, pytest's tmp_path is
rooted inside AppData\Local\Temp, so "AppData" appeared in the prefix even
though the Linux config-path logic was working as intended.

Fix

Replace the three vague substring assertions with a single exact pathlib comparison:

assert paths.config_dir == tmp_path / ".config" / "agileforecasting"

This is:

  • Stricter — exact match, not substring presence/absence
  • Platform-agnostic — result does not depend on where tmp_path is rooted
  • More explicit — the intent (Linux config dir = <home>/.config/agileforecasting) is stated directly

The production code in secure_store._config_base() is unchanged.

Test results

  • pytest tests/test_windows_compat.py → 16 passed
  • pytest --ignore=tests/test_chart_export.py → 96 passed (mirrors Windows CI job)

…t_config

The assertion `assert "AppData" not in str(paths.config_dir)` failed on
Windows-hosted CI because pytest's tmp_path is located under
AppData\Local\Temp\..., so "AppData" appears in the full absolute path even
when the Linux config-path logic is correct.

Replace the three vague substring checks with a single exact pathlib
comparison:

    assert paths.config_dir == tmp_path / ".config" / "agileforecasting"

This is stricter (exact match, not substring), platform-agnostic (does not
depend on where tmp_path is rooted), and makes the intent explicit: on Linux
the config directory must be exactly <home>/.config/agileforecasting.

The production code in secure_store._config_base() is unchanged — it was
correct before and after this fix.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@XeonNAS XeonNAS merged commit b4238d9 into main Apr 7, 2026
2 checks passed
@XeonNAS XeonNAS deleted the fix/windows-ci-linux-path-test branch April 7, 2026 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant