@@ -13,16 +13,18 @@ class TestProcessSettings:
1313
1414 def test_process_settings_preserves_python_hook_when_enabled (self ):
1515 """process_settings keeps Python hook when install_python=True."""
16- from installer .steps .claude_files import PYTHON_CHECKER_HOOK , process_settings
16+ from installer .steps .claude_files import process_settings
1717
18+ # Use absolute path like real source file
19+ python_hook = "python3 /workspaces/claude-codepro/.claude/hooks/file_checker_python.py"
1820 settings = {
1921 "hooks" : {
2022 "PostToolUse" : [
2123 {
2224 "matcher" : "Write|Edit|MultiEdit" ,
2325 "hooks" : [
24- {"type" : "command" , "command" : "python3 .claude/hooks/file_checker_qlty.py" },
25- {"type" : "command" , "command" : PYTHON_CHECKER_HOOK },
26+ {"type" : "command" , "command" : "python3 /workspaces/claude-codepro/ .claude/hooks/file_checker_qlty.py" },
27+ {"type" : "command" , "command" : python_hook },
2628 ],
2729 }
2830 ]
@@ -34,21 +36,23 @@ def test_process_settings_preserves_python_hook_when_enabled(self):
3436
3537 hooks = parsed ["hooks" ]["PostToolUse" ][0 ]["hooks" ]
3638 commands = [h ["command" ] for h in hooks ]
37- assert PYTHON_CHECKER_HOOK in commands
39+ assert any ( "file_checker_python.py" in cmd for cmd in commands )
3840 assert len (hooks ) == 2
3941
4042 def test_process_settings_removes_python_hook_when_disabled (self ):
4143 """process_settings removes Python hook when install_python=False."""
42- from installer .steps .claude_files import PYTHON_CHECKER_HOOK , process_settings
44+ from installer .steps .claude_files import process_settings
4345
46+ # Use absolute path like real source file
47+ python_hook = "python3 /workspaces/claude-codepro/.claude/hooks/file_checker_python.py"
4448 settings = {
4549 "hooks" : {
4650 "PostToolUse" : [
4751 {
4852 "matcher" : "Write|Edit|MultiEdit" ,
4953 "hooks" : [
50- {"type" : "command" , "command" : "python3 .claude/hooks/file_checker_qlty.py" },
51- {"type" : "command" , "command" : PYTHON_CHECKER_HOOK },
54+ {"type" : "command" , "command" : "python3 /workspaces/claude-codepro/ .claude/hooks/file_checker_qlty.py" },
55+ {"type" : "command" , "command" : python_hook },
5256 ],
5357 }
5458 ]
@@ -60,7 +64,7 @@ def test_process_settings_removes_python_hook_when_disabled(self):
6064
6165 hooks = parsed ["hooks" ]["PostToolUse" ][0 ]["hooks" ]
6266 commands = [h ["command" ] for h in hooks ]
63- assert PYTHON_CHECKER_HOOK not in commands
67+ assert not any ( "file_checker_python.py" in cmd for cmd in commands )
6468 assert any ("file_checker_qlty.py" in cmd for cmd in commands )
6569 assert len (hooks ) == 1
6670
@@ -78,8 +82,10 @@ def test_process_settings_handles_missing_hooks(self):
7882
7983 def test_process_settings_preserves_other_settings (self ):
8084 """process_settings preserves all other settings unchanged."""
81- from installer .steps .claude_files import PYTHON_CHECKER_HOOK , process_settings
85+ from installer .steps .claude_files import process_settings
8286
87+ # Use absolute path like real source file
88+ python_hook = "python3 /workspaces/claude-codepro/.claude/hooks/file_checker_python.py"
8389 settings = {
8490 "model" : "opus" ,
8591 "env" : {"DISABLE_TELEMETRY" : "true" },
@@ -88,7 +94,7 @@ def test_process_settings_preserves_other_settings(self):
8894 "PostToolUse" : [
8995 {
9096 "matcher" : "Write|Edit|MultiEdit" ,
91- "hooks" : [{"type" : "command" , "command" : PYTHON_CHECKER_HOOK }],
97+ "hooks" : [{"type" : "command" , "command" : python_hook }],
9298 }
9399 ]
94100 },
@@ -124,16 +130,18 @@ def test_process_settings_handles_malformed_structure(self):
124130
125131 def test_process_settings_removes_typescript_hook_when_disabled (self ):
126132 """process_settings removes TypeScript hook when install_typescript=False."""
127- from installer .steps .claude_files import TYPESCRIPT_CHECKER_HOOK , process_settings
133+ from installer .steps .claude_files import process_settings
128134
135+ # Use absolute path like real source file
136+ ts_hook = "python3 /workspaces/claude-codepro/.claude/hooks/file_checker_ts.py"
129137 settings = {
130138 "hooks" : {
131139 "PostToolUse" : [
132140 {
133141 "matcher" : "Write|Edit|MultiEdit" ,
134142 "hooks" : [
135- {"type" : "command" , "command" : "python3 .claude/hooks/file_checker_qlty.py" },
136- {"type" : "command" , "command" : TYPESCRIPT_CHECKER_HOOK },
143+ {"type" : "command" , "command" : "python3 /workspaces/claude-codepro/ .claude/hooks/file_checker_qlty.py" },
144+ {"type" : "command" , "command" : ts_hook },
137145 ],
138146 }
139147 ]
@@ -145,23 +153,26 @@ def test_process_settings_removes_typescript_hook_when_disabled(self):
145153
146154 hooks = parsed ["hooks" ]["PostToolUse" ][0 ]["hooks" ]
147155 commands = [h ["command" ] for h in hooks ]
148- assert TYPESCRIPT_CHECKER_HOOK not in commands
156+ assert not any ( "file_checker_ts.py" in cmd for cmd in commands )
149157 assert any ("file_checker_qlty.py" in cmd for cmd in commands )
150158 assert len (hooks ) == 1
151159
152160 def test_process_settings_removes_both_hooks_when_both_disabled (self ):
153161 """process_settings removes both Python and TypeScript hooks when both disabled."""
154- from installer .steps .claude_files import PYTHON_CHECKER_HOOK , TYPESCRIPT_CHECKER_HOOK , process_settings
162+ from installer .steps .claude_files import process_settings
155163
164+ # Use absolute paths like real source file
165+ python_hook = "python3 /workspaces/claude-codepro/.claude/hooks/file_checker_python.py"
166+ ts_hook = "python3 /workspaces/claude-codepro/.claude/hooks/file_checker_ts.py"
156167 settings = {
157168 "hooks" : {
158169 "PostToolUse" : [
159170 {
160171 "matcher" : "Write|Edit|MultiEdit" ,
161172 "hooks" : [
162- {"type" : "command" , "command" : "python3 .claude/hooks/file_checker_qlty.py" },
163- {"type" : "command" , "command" : PYTHON_CHECKER_HOOK },
164- {"type" : "command" , "command" : TYPESCRIPT_CHECKER_HOOK },
173+ {"type" : "command" , "command" : "python3 /workspaces/claude-codepro/ .claude/hooks/file_checker_qlty.py" },
174+ {"type" : "command" , "command" : python_hook },
175+ {"type" : "command" , "command" : ts_hook },
165176 ],
166177 }
167178 ]
@@ -173,8 +184,8 @@ def test_process_settings_removes_both_hooks_when_both_disabled(self):
173184
174185 hooks = parsed ["hooks" ]["PostToolUse" ][0 ]["hooks" ]
175186 commands = [h ["command" ] for h in hooks ]
176- assert PYTHON_CHECKER_HOOK not in commands
177- assert TYPESCRIPT_CHECKER_HOOK not in commands
187+ assert not any ( "file_checker_python.py" in cmd for cmd in commands )
188+ assert not any ( "file_checker_ts.py" in cmd for cmd in commands )
178189 assert any ("file_checker_qlty.py" in cmd for cmd in commands )
179190 assert len (hooks ) == 1
180191
0 commit comments