33import pytest
44from itertools import product
55
6- from cpp_linter_hooks .util import ensure_installed , DEFAULT_CLANG_VERSION
6+ from cpp_linter_hooks .util import is_installed , ensure_installed , DEFAULT_CLANG_VERSION
77
88
99VERSIONS = [None , "16" ]
1010TOOLS = ["clang-format" , "clang-tidy" ]
1111
1212
13- @pytest .mark .skip (reason = "see https://github.com/cpp-linter/cpp-linter-hooks/pull/29" )
13+ clang_tools_installed = pytest .mark .skipif (
14+ is_installed ('clang-format' , '13' ) or is_installed ('clang-tidy' , '13' ),
15+ reason = "https://github.com/cpp-linter/cpp-linter-hooks/pull/29#issuecomment-1952873903" ,
16+ )
17+
18+
19+ @clang_tools_installed
1420@pytest .mark .parametrize (("tool" , "version" ), list (product (TOOLS , VERSIONS )))
1521def test_ensure_installed (tool , version , tmp_path , monkeypatch , caplog ):
1622
@@ -23,10 +29,10 @@ def test_ensure_installed(tool, version, tmp_path, monkeypatch, caplog):
2329 caplog .clear ()
2430 caplog .set_level (logging .INFO , logger = "cpp_linter_hooks.util" )
2531
26- if version is not None :
27- ensure_installed (tool , version = version )
28- else :
32+ if version is None :
2933 ensure_installed (tool )
34+ else :
35+ ensure_installed (tool , version = version )
3036
3137 bin_version = version or DEFAULT_CLANG_VERSION
3238 assert (bin_path / f"{ tool } -{ bin_version } " ).is_file ()
0 commit comments