Skip to content

Commit 7c485c9

Browse files
committed
fix(tests): use cross-platform paths for Windows CI compatibility
Use tmp_path fixture instead of hardcoded /tmp paths which fail on Windows (converted to D:\tmp\...).
1 parent 22eb866 commit 7c485c9

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

tests/test_local_state.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,12 @@ def test_get_local_state_path_env_relative(self, monkeypatch):
225225
assert path.name == "custom_local.json"
226226
assert path.parent == Path.cwd()
227227

228-
def test_get_local_state_path_env_absolute(self, monkeypatch):
228+
def test_get_local_state_path_env_absolute(self, monkeypatch, tmp_path):
229229
"""Test absolute path from environment variable."""
230-
monkeypatch.setenv("CLI_AUDIT_LOCAL_FILE", "/tmp/local_state.json")
230+
test_path = tmp_path / "local_state.json"
231+
monkeypatch.setenv("CLI_AUDIT_LOCAL_FILE", str(test_path))
231232
path = get_local_state_path()
232-
assert str(path) == "/tmp/local_state.json"
233+
assert path == test_path
233234

234235

235236
class TestLoadLocalState:

tests/test_upstream_cache.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,12 @@ def test_get_upstream_cache_path_env_relative(self, monkeypatch):
196196
assert path.name == "custom_upstream.json"
197197
assert path.parent == Path.cwd()
198198

199-
def test_get_upstream_cache_path_env_absolute(self, monkeypatch):
199+
def test_get_upstream_cache_path_env_absolute(self, monkeypatch, tmp_path):
200200
"""Test absolute path from environment variable."""
201-
monkeypatch.setenv("CLI_AUDIT_UPSTREAM_FILE", "/tmp/upstream.json")
201+
test_path = tmp_path / "upstream.json"
202+
monkeypatch.setenv("CLI_AUDIT_UPSTREAM_FILE", str(test_path))
202203
path = get_upstream_cache_path()
203-
assert str(path) == "/tmp/upstream.json"
204+
assert path == test_path
204205

205206

206207
class TestLoadUpstreamCache:

0 commit comments

Comments
 (0)