Skip to content

Commit df41efc

Browse files
committed
fix: update dependencies and use public function
1 parent d70b181 commit df41efc

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

clang_tools/wheel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from argparse import ArgumentParser
2-
from cpp_linter_hooks.util import _resolve_install
2+
from cpp_linter_hooks.util import resolve_install
33

44

55
def get_parser() -> ArgumentParser:
@@ -22,7 +22,7 @@ def get_parser() -> ArgumentParser:
2222
def main() -> int:
2323
parser = get_parser()
2424
args = parser.parse_args()
25-
path = _resolve_install(args.tool, args.version)
25+
path = resolve_install(args.tool, args.version)
2626
version_str = f" version {args.version}" if args.version else " latest version"
2727
if path:
2828
print(f"{args.tool}{version_str} installed at: {path}")

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ classifiers = [
3232
]
3333

3434
dependencies = [
35-
"cpp-linter-hooks>=1.1.6",
35+
"cpp-linter-hooks>=1.1.7",
3636
]
3737

3838
dynamic = ["version"]

tests/test_wheel.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,34 @@
33

44

55
def test_main_success(monkeypatch):
6-
# Patch _resolve_install to simulate success
6+
# Patch resolve_install to simulate success
77
monkeypatch.setattr(
8-
"clang_tools.wheel._resolve_install",
8+
"clang_tools.wheel.resolve_install",
99
lambda tool, version: "/usr/bin/clang-format",
1010
)
1111
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"]
1313
)
1414
exit_code = main()
1515
assert exit_code == 0
1616

1717

1818
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)
2021
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"]
2523
)
2624
exit_code = main()
2725
assert exit_code == 1
2826

2927

3028
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
3230
monkeypatch.setattr(
33-
"clang_tools.wheel._resolve_install",
31+
"clang_tools.wheel.resolve_install",
3432
lambda tool, version: "/usr/bin/clang-format",
3533
)
36-
monkeypatch.setattr(sys, "argv", ["util.py"])
34+
monkeypatch.setattr(sys, "argv", ["wheel.py"])
3735
exit_code = main()
3836
assert exit_code == 0

0 commit comments

Comments
 (0)