|
3 | 3 |
|
4 | 4 |
|
5 | 5 | def test_main_success(monkeypatch): |
6 | | - # Patch _resolve_install to simulate success |
| 6 | + # Patch resolve_install to simulate success |
7 | 7 | monkeypatch.setattr( |
8 | | - "clang_tools.wheel._resolve_install", |
| 8 | + "clang_tools.wheel.resolve_install", |
9 | 9 | lambda tool, version: "/usr/bin/clang-format", |
10 | 10 | ) |
11 | 11 | monkeypatch.setattr( |
12 | | - sys, "argv", ["util.py", "--tool", "clang-format", "--version", "15.0.7"] |
| 12 | + sys, "argv", ["wheel.py", "--tool", "clang-format", "--version", "15.0.7"] |
13 | 13 | ) |
14 | 14 | exit_code = main() |
15 | 15 | assert exit_code == 0 |
16 | 16 |
|
17 | 17 |
|
18 | 18 | def test_main_failure(monkeypatch): |
19 | | - # Patch _resolve_install to simulate failure |
| 19 | + # Patch resolve_install to simulate failure |
| 20 | + monkeypatch.setattr("clang_tools.wheel.resolve_install", lambda tool, version: None) |
20 | 21 | monkeypatch.setattr( |
21 | | - "clang_tools.wheel._resolve_install", lambda tool, version: None |
22 | | - ) |
23 | | - monkeypatch.setattr( |
24 | | - sys, "argv", ["util.py", "--tool", "clang-format", "--version", "99.99.99"] |
| 22 | + sys, "argv", ["wheel.py", "--tool", "clang-format", "--version", "99.99.99"] |
25 | 23 | ) |
26 | 24 | exit_code = main() |
27 | 25 | assert exit_code == 1 |
28 | 26 |
|
29 | 27 |
|
30 | 28 | def test_main_default_tool(monkeypatch): |
31 | | - # Patch _resolve_install to simulate success for default tool |
| 29 | + # Patch resolve_install to simulate success for default tool |
32 | 30 | monkeypatch.setattr( |
33 | | - "clang_tools.wheel._resolve_install", |
| 31 | + "clang_tools.wheel.resolve_install", |
34 | 32 | lambda tool, version: "/usr/bin/clang-format", |
35 | 33 | ) |
36 | | - monkeypatch.setattr(sys, "argv", ["util.py"]) |
| 34 | + monkeypatch.setattr(sys, "argv", ["wheel.py"]) |
37 | 35 | exit_code = main() |
38 | 36 | assert exit_code == 0 |
0 commit comments