| | @@ -1,9 +1,10 @@ |
| 1 | 1 | from contextlib import redirect_stdout |
| 2 | 2 | from io import StringIO |
| 3 | 3 | import json |
| 4 | | -삭제: from pathlib import Path |
| 4 | +추가: from pathlib import Path, PurePosixPath, PureWindowsPath |
| 5 | 5 | import tempfile |
| 6 | 6 | import subprocess |
| 7 | +추가: import sys |
| 7 | 8 | import unittest |
| 8 | 9 | from unittest.mock import patch |
| 9 | 10 | |
| | @@ -122,6 +123,7 @@ class RunnerTests(unittest.TestCase): |
| 122 | 123 | self.assertFalse(failed["windows_runtime_tested"]) |
| 123 | 124 | execute.assert_called_once() |
| 124 | 125 | |
| 126 | +추가: @unittest.skipUnless(sys.platform == "linux", "Linux MinGW 실행 파일 탐색 시험임") |
| 125 | 127 | def test_linked_worktree_finds_setup_tools_without_path_export(self): |
| 126 | 128 | with tempfile.TemporaryDirectory(dir=run_rust.ROOT / "tests/ci") as directory: |
| 127 | 129 | base = Path(directory) |
| | @@ -148,18 +150,19 @@ class RunnerTests(unittest.TestCase): |
| 148 | 150 | ) |
| 149 | 151 | |
| 150 | 152 | def test_local_bootstraps_missing_cross_tools_and_reloads_paths(self): |
| 151 | | -삭제: root = Path("/repo") |
| 152 | | -삭제: with ( |
| 153 | | -삭제: patch.object(run_rust, "prepare_cross_build", side_effect=[ValueError("missing"), None]) as detect, |
| 154 | | -삭제: patch.object(run_rust.subprocess, "run") as setup, |
| 155 | | -삭제: patch.object(run_rust, "prepare_tools") as reload, |
| 156 | | -삭제: ): |
| 157 | | -삭제: run_rust.prepare_local_tools(root) |
| 158 | | -삭제: setup.assert_called_once_with( |
| 159 | | -삭제: ["bash", "/repo/tests/ci/setup_windows.sh"], cwd=root, check=True, |
| 160 | | -삭제: ) |
| 161 | | -삭제: reload.assert_called_once_with(root) |
| 162 | | -삭제: self.assertEqual(detect.call_count, 2) |
| 153 | +추가: for root in (Path("/repo"), PurePosixPath("/repo"), PureWindowsPath("C:/repo")): |
| 154 | +추가: with self.subTest(root=root): |
| 155 | +추가: with ( |
| 156 | +추가: patch.object(run_rust, "prepare_cross_build", side_effect=[ValueError("missing"), None]) as detect, |
| 157 | +추가: patch.object(run_rust.subprocess, "run") as setup, |
| 158 | +추가: patch.object(run_rust, "prepare_tools") as reload, |
| 159 | +추가: ): |
| 160 | +추가: run_rust.prepare_local_tools(root) |
| 161 | +추가: setup.assert_called_once_with( |
| 162 | +추가: ["bash", str(root / "tests/ci/setup_windows.sh")], cwd=root, check=True, |
| 163 | +추가: ) |
| 164 | +추가: reload.assert_called_once_with(root) |
| 165 | +추가: self.assertEqual(detect.call_count, 2) |
| 163 | 166 | |
| 164 | 167 | def test_existing_cross_tools_do_not_trigger_downloads(self): |
| 165 | 168 | with ( |
| | @@ -179,6 +182,7 @@ class RunnerTests(unittest.TestCase): |
| 179 | 182 | with self.assertRaisesRegex(ValueError, "setup_windows.sh"): |
| 180 | 183 | run_rust.prepare_cross_build() |
| 181 | 184 | |
| 185 | +추가: @unittest.skipUnless(sys.platform == "linux", "Linux 파일시스템과 소유권 검사 시험임") |
| 182 | 186 | def test_filesystem_skip_is_limited_to_publication_test_crates(self): |
| 183 | 187 | with tempfile.TemporaryDirectory(dir=run_rust.ROOT / "tests/ci") as directory: |
| 184 | 188 | root = Path(directory) |
| | @@ -191,7 +195,6 @@ class RunnerTests(unittest.TestCase): |
| 191 | 195 | root / "experiments/rust-file-publication/Cargo.toml", |
| 192 | 196 | ] |
| 193 | 197 | with ( |
| 194 | | -삭제: patch.object(run_rust.sys, "platform", "linux"), |
| 195 | 198 | patch.object(run_rust, "manifests", return_value=paths), |
| 196 | 199 | patch.object(run_rust.subprocess, "check_output", return_value="1021994\n"), |
| 197 | 200 | patch.object(run_rust.subprocess, "run", return_value=subprocess.CompletedProcess([], 0)) as cargo, |