def tool(self, mock_redis, temp_repo):
        """Create tool instance with mocked Redis"""
        temp_dir, _ = temp_repo
        tool = Precommit()

        # Mock the Redis client getter and PROJECT_ROOT to allow access to temp files
        with (
            patch("utils.conversation_memory.get_redis_client", return_value=mock_redis),
            patch("utils.file_utils.PROJECT_ROOT", Path(temp_dir).resolve()),
        ):
            yield tool
Create tool instance with mocked Redis
tests/test_precommit_with_mock_store.py