From d5d81919bf7a07559029559256dd987d3bf1c71c Mon Sep 17 00:00:00 2001 From: Auto Date: Sat, 10 Jan 2026 11:04:36 +0200 Subject: [PATCH] fix: rename test_hook to check_hook to fix pytest fixture error The test_hook helper function was being incorrectly interpreted by pytest as a test function due to the 'test_' prefix. Pytest attempted to inject fixtures for its parameters (command, should_block), causing an error. Changes: - Renamed test_hook() to check_hook() in test_security.py - Updated all call sites (lines 206 and 276) - Updated docstring to clarify it's a helper function This fixes the "fixture 'command' not found" error when running pytest. Co-Authored-By: Claude Opus 4.5 --- test_security.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test_security.py b/test_security.py index ce57ebe..6788a6d 100644 --- a/test_security.py +++ b/test_security.py @@ -18,8 +18,8 @@ from security import ( ) -def test_hook(command: str, should_block: bool) -> bool: - """Test a single command against the security hook.""" +def check_hook(command: str, should_block: bool) -> bool: + """Check a single command against the security hook (helper function).""" input_data = {"tool_name": "Bash", "tool_input": {"command": command}} result = asyncio.run(bash_security_hook(input_data)) was_blocked = result.get("decision") == "block" @@ -203,7 +203,7 @@ def main(): ] for cmd in dangerous: - if test_hook(cmd, should_block=True): + if check_hook(cmd, should_block=True): passed += 1 else: failed += 1 @@ -273,7 +273,7 @@ def main(): ] for cmd in safe: - if test_hook(cmd, should_block=False): + if check_hook(cmd, should_block=False): passed += 1 else: failed += 1