Skip to content

Commit 965762e

Browse files
committed
fix(tests): skip additional Windows-incompatible tests
- test_logging.py: Skip file logging tests due to Windows file locking - test_reconcile.py: Skip path detection tests using Unix-style paths
1 parent eda62b0 commit 965762e

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

tests/test_logging.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@
33
"""
44

55
import logging
6+
import sys
67
import tempfile
78
from pathlib import Path
89

910
import pytest
1011

12+
# Skip marker for Windows (file locking issues with temp files)
13+
skip_on_windows = pytest.mark.skipif(
14+
sys.platform == "win32",
15+
reason="Windows file locking prevents temp file cleanup"
16+
)
17+
1118
from cli_audit.logging_config import (
1219
setup_logging,
1320
get_logger,
@@ -46,6 +53,7 @@ def test_setup_logging_quiet(self):
4653
]
4754
assert len(console_handlers) == 0
4855

56+
@skip_on_windows
4957
def test_setup_logging_with_file(self):
5058
"""Test logging to file."""
5159
with tempfile.TemporaryDirectory() as tmpdir:
@@ -64,6 +72,7 @@ def test_setup_logging_with_file(self):
6472
content = log_file.read_text()
6573
assert "Test message" in content
6674

75+
@skip_on_windows
6776
def test_setup_logging_creates_log_directory(self):
6877
"""Test that log directory is created if it doesn't exist."""
6978
with tempfile.TemporaryDirectory() as tmpdir:

tests/test_reconcile.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,19 @@
55
from __future__ import annotations
66

77
import os
8+
import sys
89
import tempfile
910
from pathlib import Path
1011
from unittest.mock import MagicMock, patch, mock_open
1112

1213
import pytest
1314

15+
# Skip marker for Windows (Unix-style paths and PATH separator differences)
16+
skip_on_windows = pytest.mark.skipif(
17+
sys.platform == "win32",
18+
reason="Uses Unix-style paths and PATH separator (:)"
19+
)
20+
1421
from cli_audit.reconcile import (
1522
Installation,
1623
ReconciliationResult,
@@ -124,6 +131,7 @@ def test_classify_via_path_unknown(self):
124131
class TestDetectInstallations:
125132
"""Tests for installation detection."""
126133

134+
@skip_on_windows
127135
@patch("cli_audit.reconcile.validate_installation")
128136
@patch("cli_audit.reconcile.shutil.which")
129137
@patch("os.path.exists")
@@ -163,6 +171,7 @@ def exists_side_effect(path):
163171
assert installations[0].version == "14.1.0"
164172
assert installations[0].active is True
165173

174+
@skip_on_windows
166175
@patch("cli_audit.reconcile.validate_installation")
167176
@patch("cli_audit.reconcile.shutil.which")
168177
@patch("os.path.exists")
@@ -543,6 +552,7 @@ def reconcile_side_effect(tool, *args, **kwargs):
543552
class TestPathVerification:
544553
"""Tests for PATH verification."""
545554

555+
@skip_on_windows
546556
def test_verify_path_ordering_correct(self, monkeypatch):
547557
"""Test PATH ordering when correct."""
548558
monkeypatch.setenv("PATH", "/home/user/.cargo/bin:/home/user/.local/bin:/usr/local/bin:/usr/bin")
@@ -574,6 +584,7 @@ def expand_side_effect(path):
574584
issues = verify_path_ordering()
575585
assert len(issues) == 0
576586

587+
@skip_on_windows
577588
def test_verify_path_ordering_incorrect(self, monkeypatch):
578589
"""Test PATH ordering when incorrect."""
579590
monkeypatch.setenv("PATH", "/usr/bin:/home/user/.cargo/bin")

0 commit comments

Comments
 (0)