@@ -46,8 +46,18 @@ def test_shows_disabled_checks(self, tmp_path: Path, capsys: Any) -> None:
4646
4747 # Parse JSON output
4848 output = json .loads (captured .out )
49+ # Should only mention ruff in the enabled checks
50+ assert "will automatically run ruff after" in output ["additionalContext" ]
51+ # Should not mention pytest or mypy as enabled
52+ assert "mypy" not in output [
53+ "additionalContext"
54+ ] or "disabled" in output .get ("systemMessage" , "" )
55+ assert "pytest" not in output [
56+ "additionalContext"
57+ ] or "disabled" in output .get ("systemMessage" , "" )
58+
4959 assert "systemMessage" in output
50- assert "currently disabled: pytest, mypy " in output ["systemMessage" ]
60+ assert "currently disabled: mypy, pytest " in output ["systemMessage" ]
5161 assert (
5262 "Use /pytest, /mypy, or /ruff to toggle them back on"
5363 in output ["systemMessage" ]
@@ -70,8 +80,12 @@ def test_shows_all_disabled_checks(self, tmp_path: Path, capsys: Any) -> None:
7080
7181 # Parse JSON output
7282 output = json .loads (captured .out )
83+ # When no checks are enabled, should show special message
84+ assert (
85+ "No quality checks are currently enabled" in output ["additionalContext" ]
86+ )
7387 assert "systemMessage" in output
74- assert "currently disabled: pytest , mypy, ruff " in output ["systemMessage" ]
88+ assert "currently disabled: ruff , mypy, pytest " in output ["systemMessage" ]
7589
7690 def test_shows_single_disabled_check (self , tmp_path : Path , capsys : Any ) -> None :
7791 """Test message when only one check is disabled."""
@@ -88,5 +102,33 @@ def test_shows_single_disabled_check(self, tmp_path: Path, capsys: Any) -> None:
88102
89103 # Parse JSON output
90104 output = json .loads (captured .out )
105+ # Should only mention mypy and pytest as enabled (with "and")
106+ assert (
107+ "will automatically run mypy and pytest after"
108+ in output ["additionalContext" ]
109+ )
91110 assert "systemMessage" in output
92111 assert "currently disabled: ruff" in output ["systemMessage" ]
112+
113+ def test_shows_single_enabled_check (self , tmp_path : Path , capsys : Any ) -> None :
114+ """Test message when only one check is enabled."""
115+ hook_input = HookInput (session_id = None , tool_input = {}, raw = {})
116+ with patch .dict (os .environ , {"CLAUDE_PROJECT_DIR" : str (tmp_path )}):
117+ # Disable mypy and pytest, leaving only ruff enabled
118+ state = QualityCheckState (tmp_path )
119+ state .disable ("mypy" )
120+ state .disable ("pytest" )
121+
122+ hook = SessionStartHook (hook_input )
123+ exit_code = hook .run ()
124+ assert exit_code == 0
125+ captured = capsys .readouterr ()
126+
127+ # Parse JSON output
128+ output = json .loads (captured .out )
129+ # Should only mention ruff (no "and")
130+ assert "will automatically run ruff after" in output ["additionalContext" ]
131+ # Should not have "and" when there's only one
132+ assert " and " not in output ["additionalContext" ]
133+ assert "systemMessage" in output
134+ assert "currently disabled: mypy, pytest" in output ["systemMessage" ]
0 commit comments