|
5 | 5 | from __future__ import annotations |
6 | 6 |
|
7 | 7 | import os |
| 8 | +import sys |
8 | 9 | import tempfile |
9 | 10 | import threading |
10 | 11 | import time |
|
29 | 30 | from cli_audit.environment import Environment |
30 | 31 | from cli_audit.installer import InstallResult, StepResult |
31 | 32 |
|
| 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 | + |
32 | 39 |
|
33 | 40 | class TestToolSpec: |
34 | 41 | """Tests for ToolSpec dataclass.""" |
@@ -457,6 +464,7 @@ def select_side_effect(tool_name, language, config, env, verbose=False): |
457 | 464 | assert len(groups["uv"]) == 2 |
458 | 465 |
|
459 | 466 |
|
| 467 | +@skip_on_windows |
460 | 468 | class TestGenerateRollbackScript: |
461 | 469 | """Tests for generate_rollback_script function.""" |
462 | 470 |
|
@@ -572,6 +580,7 @@ def test_generate_rollback_script_multiple(self): |
572 | 580 | class TestExecuteRollback: |
573 | 581 | """Tests for execute_rollback function.""" |
574 | 582 |
|
| 583 | + @skip_on_windows |
575 | 584 | def test_execute_rollback_success(self): |
576 | 585 | """Test successful rollback execution.""" |
577 | 586 | # Create a simple rollback script |
@@ -610,6 +619,7 @@ def test_execute_rollback_failure(self): |
610 | 619 | class TestBulkInstall: |
611 | 620 | """Tests for bulk_install main function.""" |
612 | 621 |
|
| 622 | + @skip_on_windows |
613 | 623 | @patch("cli_audit.bulk.install_tool") |
614 | 624 | @patch("cli_audit.bulk.get_missing_tools") |
615 | 625 | 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): |
727 | 737 | assert result.tools_attempted == ("ripgrep", "black") |
728 | 738 | assert len(result.successes) == 0 |
729 | 739 |
|
| 740 | + @skip_on_windows |
730 | 741 | @patch("cli_audit.bulk.install_tool") |
731 | 742 | def test_bulk_install_fail_fast(self, mock_install): |
732 | 743 | """Test bulk install with fail-fast mode with dependencies.""" |
@@ -787,6 +798,7 @@ def install_side_effect(*args, **kwargs): |
787 | 798 | assert len(result.failures) == 1 |
788 | 799 | assert call_count == 2 # Should have stopped after second tool |
789 | 800 |
|
| 801 | + @skip_on_windows |
790 | 802 | @patch("cli_audit.bulk.install_tool") |
791 | 803 | def test_bulk_install_parallel(self, mock_install): |
792 | 804 | """Test parallel bulk install.""" |
@@ -834,6 +846,7 @@ def install_side_effect(*args, **kwargs): |
834 | 846 | assert len(result.successes) == 4 |
835 | 847 | assert install_count == 4 |
836 | 848 |
|
| 849 | + @skip_on_windows |
837 | 850 | @patch("cli_audit.bulk.install_tool") |
838 | 851 | @patch("cli_audit.bulk.execute_rollback") |
839 | 852 | def test_bulk_install_atomic_rollback(self, mock_rollback, mock_install): |
|
0 commit comments