Skip to content

Commit eda62b0

Browse files
committed
fix(tests): skip rollback script tests on Windows
Rollback scripts use Unix shell syntax (shebang, bash commands) which don't work on Windows. Skip these tests on win32 platform: - TestGenerateRollbackScript (entire class) - test_execute_rollback_success - test_bulk_install_explicit_success - test_bulk_install_fail_fast - test_bulk_install_parallel - test_bulk_install_atomic_rollback
1 parent bd97dad commit eda62b0

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

tests/test_bulk.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from __future__ import annotations
66

77
import os
8+
import sys
89
import tempfile
910
import threading
1011
import time
@@ -29,6 +30,12 @@
2930
from cli_audit.environment import Environment
3031
from cli_audit.installer import InstallResult, StepResult
3132

33+
# Skip marker for Windows (rollback scripts are Unix shell scripts)
34+
skip_on_windows = pytest.mark.skipif(
35+
sys.platform == "win32",
36+
reason="Rollback scripts use Unix shell syntax"
37+
)
38+
3239

3340
class TestToolSpec:
3441
"""Tests for ToolSpec dataclass."""
@@ -457,6 +464,7 @@ def select_side_effect(tool_name, language, config, env, verbose=False):
457464
assert len(groups["uv"]) == 2
458465

459466

467+
@skip_on_windows
460468
class TestGenerateRollbackScript:
461469
"""Tests for generate_rollback_script function."""
462470

@@ -572,6 +580,7 @@ def test_generate_rollback_script_multiple(self):
572580
class TestExecuteRollback:
573581
"""Tests for execute_rollback function."""
574582

583+
@skip_on_windows
575584
def test_execute_rollback_success(self):
576585
"""Test successful rollback execution."""
577586
# Create a simple rollback script
@@ -610,6 +619,7 @@ def test_execute_rollback_failure(self):
610619
class TestBulkInstall:
611620
"""Tests for bulk_install main function."""
612621

622+
@skip_on_windows
613623
@patch("cli_audit.bulk.install_tool")
614624
@patch("cli_audit.bulk.get_missing_tools")
615625
def test_bulk_install_explicit_success(self, mock_get_missing, mock_install):
@@ -727,6 +737,7 @@ def test_bulk_install_dry_run(self, mock_install):
727737
assert result.tools_attempted == ("ripgrep", "black")
728738
assert len(result.successes) == 0
729739

740+
@skip_on_windows
730741
@patch("cli_audit.bulk.install_tool")
731742
def test_bulk_install_fail_fast(self, mock_install):
732743
"""Test bulk install with fail-fast mode with dependencies."""
@@ -787,6 +798,7 @@ def install_side_effect(*args, **kwargs):
787798
assert len(result.failures) == 1
788799
assert call_count == 2 # Should have stopped after second tool
789800

801+
@skip_on_windows
790802
@patch("cli_audit.bulk.install_tool")
791803
def test_bulk_install_parallel(self, mock_install):
792804
"""Test parallel bulk install."""
@@ -834,6 +846,7 @@ def install_side_effect(*args, **kwargs):
834846
assert len(result.successes) == 4
835847
assert install_count == 4
836848

849+
@skip_on_windows
837850
@patch("cli_audit.bulk.install_tool")
838851
@patch("cli_audit.bulk.execute_rollback")
839852
def test_bulk_install_atomic_rollback(self, mock_rollback, mock_install):

0 commit comments

Comments
 (0)