diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index 985111a..282f97b 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -119,7 +119,7 @@ jobs: shell: bash run: | case "${{ matrix.version }}" in - 15|16) + 15|16|18) clang-format.exe --version clang-tidy.exe --version clang-query.exe --version diff --git a/clang_tools/install.py b/clang_tools/install.py index e53dbc8..d3162d7 100644 --- a/clang_tools/install.py +++ b/clang_tools/install.py @@ -234,7 +234,7 @@ def uninstall_tool(tool_name: str, version: str, directory: str): symlink.unlink() -def uninstall_clang_tools(version: str, directory: str): +def uninstall_clang_tools(tools: str, version: str, directory: str): """Uninstall a clang tool of a given version. :param version: The version of the clang-tools to remove. @@ -243,7 +243,7 @@ def uninstall_clang_tools(version: str, directory: str): """ install_dir = install_dir_name(directory) print(f"Uninstalling version {version} from {str(install_dir)}") - for tool in ("clang-format", "clang-tidy"): + for tool in tools: uninstall_tool(tool, version, install_dir) diff --git a/clang_tools/main.py b/clang_tools/main.py index 8b0e53e..7bb7239 100644 --- a/clang_tools/main.py +++ b/clang_tools/main.py @@ -68,7 +68,7 @@ def main(): args = parser.parse_args() if args.uninstall: - uninstall_clang_tools(args.uninstall, args.directory) + uninstall_clang_tools(args.uninstall, args.tool, args.directory) elif args.install: version = Version(args.install) if version.info != (0, 0, 0): diff --git a/tests/test_install.py b/tests/test_install.py index 3820907..e45e89c 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -55,20 +55,22 @@ def test_create_symlink(monkeypatch: pytest.MonkeyPatch, tmp_path: Path): assert not create_sym_link(tool_name, version, str(tmp_path), True) +@pytest.mark.parametrize( + "tool_name", + ["clang-format", "clang-tidy", "clang-query", "clang-apply-replacements"], +) @pytest.mark.parametrize("version", ["12"]) -def test_install_tools(monkeypatch: pytest.MonkeyPatch, tmp_path: Path, version: str): +def test_install_tools( + monkeypatch: pytest.MonkeyPatch, tmp_path: Path, tool_name: str, version: str +): """Test install tools to a temp directory.""" monkeypatch.chdir(tmp_path) - tool_name = "clang-format" - assert install_tool(tool_name, version, str(tmp_path), False) # invoking again should return False assert not install_tool(tool_name, version, str(tmp_path), False) # uninstall the tool deliberately - uninstall_clang_tools(version, str(tmp_path)) - assert f"{tool_name}-{version}{suffix}" not in [ - fd.name for fd in tmp_path.iterdir() - ] + uninstall_clang_tools(tool_name, version, str(tmp_path)) + assert f"{tool_name}-{version}{suffix}" in [fd.name for fd in tmp_path.iterdir()] @pytest.mark.parametrize("version", ["0"])