Coverage for tests / unit / tools / executor / test_tool_executor_fmt_exclusion.py: 100%
10 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
1"""Tests for fmt exclusion of non-fixing tools like Bandit.
3These tests ensure that format action (fmt) excludes Bandit by default and that
4an explicit request for fmt with Bandit yields a helpful error.
5"""
7import pytest
8from assertpy import assert_that
10from lintro.utils.execution.tool_configuration import get_tools_to_run
13def test_fmt_excludes_bandit_by_default() -> None:
14 """Fmt should include only tools that can_fix (Bandit excluded)."""
15 result = get_tools_to_run(tools=None, action="fmt")
16 # result.to_run is a list of string names
17 assert_that(result.to_run).does_not_contain("bandit")
20def test_fmt_explicit_bandit_raises_error() -> None:
21 """Explicit fmt of Bandit should raise a ValueError with helpful message."""
22 with pytest.raises(ValueError) as exc:
23 get_tools_to_run(tools="bandit", action="fmt")
24 assert_that(str(exc.value)).contains("does not support formatting")