Skip to content

Commit 385fdaa

Browse files
committed
fix: use pytest.mark.skipif instead of @pytest.mark.skip
1 parent 0d442cd commit 385fdaa

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

tests/test_util.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,20 @@
33
import pytest
44
from 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

99
VERSIONS = [None, "16"]
1010
TOOLS = ["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)))
1521
def 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

Comments
 (0)