~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
test: delete tests/test_google_pse.py - H7_MOCK_IDENTITY tautology (#4275)
LearningCircuitc68949d28359
diff --git a/tests/test_google_pse.py b/tests/test_google_pse.pydeleted file mode 100644index 1ecc8aeae8..0000000000--- a/tests/test_google_pse.py+++ /dev/null@@ -1,153 +0,0 @@-"""-Test script for Google Programmable Search Engine integration.-Run this script to verify that your Google PSE API key and search engine ID are working.-"""--import os-import time--import pytest-import requests-from dotenv import load_dotenv-from loguru import logger--# Load environment variables from .env file-load_dotenv()---def print_step(message):- """Helper function to print and log a step with a timestamp"""- print(f"[{time.strftime('%H:%M:%S')}] {message}")- logger.info(message)---def check_api_quota(api_key, search_engine_id):- """- Make a direct minimal request to check API quota status- Returns a tuple of (is_quota_ok, error_message)- """- url = "https://www.googleapis.com/customsearch/v1"- params = {- "key": api_key,- "cx": search_engine_id,- "q": "test", # Minimal query- "num": 1, # Request only 1 result- }-- try:- # Mock the response instead of making a real API call during testing- if os.environ.get("PYTEST_CURRENT_TEST"):- # In test mode, return success- return True, None-- response = requests.get(url, params=params, timeout=10)-- # Check for quota errors specifically- if response.status_code == 429:- return (- False,- "API quota exceeded. Google PSE has a limit of 100 requests per day on the free tier.",- )- if response.status_code != 200:- return False, f"API error: {response.status_code} - {response.text}"-- # If we get here, the API is working- return True, None-- except Exception as e:- return False, f"Error checking API: {e!s}"---def test_google_pse_search(monkeypatch, max_retries=3, retry_delay=2):- """- Test Google PSE search engine with retry logic and rate limiting- """- # Mock environment variables- monkeypatch.setenv("GOOGLE_PSE_API_KEY", "mock_api_key")- monkeypatch.setenv("GOOGLE_PSE_ENGINE_ID", "mock_engine_id")-- # Mock the requests.get function to avoid actual API calls- def mock_requests_get(*args, **kwargs):- from unittest.mock import Mock-- mock_response = Mock()- mock_response.status_code = 200- mock_response.json.return_value = {- "items": [- {- "title": "Test Result",- "link": "https://example.com/result",- "snippet": "This is a test result snippet.",- }- ]- }- return mock_response-- monkeypatch.setattr("requests.get", mock_requests_get)-- # Set up required components for testing- api_key = os.getenv("GOOGLE_PSE_API_KEY")- search_engine_id = os.getenv("GOOGLE_PSE_ENGINE_ID")-- # Check if API key and search engine ID are set (should be from our mocks)- assert api_key is not None- assert search_engine_id is not None-- # Since the create_search_engine function is imported at the top level,- # we need to test the engine creation more directly- try:- # Mock the actual engine constructor to avoid API validation- from unittest.mock import Mock-- # Create a mock engine directly- mock_engine = Mock()- mock_engine.run.return_value = [- {- "title": "Test Result",- "url": "https://example.com/result",- "snippet": "This is a test result snippet.",- }- ]-- # Basic validation that the mock works- assert mock_engine is not None-- # Test running a query- results = mock_engine.run("test query")- assert len(results) > 0- assert results[0]["title"] == "Test Result"-- except ImportError:- pytest.skip("Google PSE search engine not available")- return True-- except Exception as e:- print_step(f"❌ Error: {e!s}")- logger.exception("Exception in test_google_pse_search")- return False---if __name__ == "__main__":- try:- print_step("Test script started")- success = test_google_pse_search()- if success:- print_step(- "\n✅ Google Programmable Search Engine test completed successfully"- )- else:- print_step("\n❌ Google Programmable Search Engine test failed")- print_step("\nPlease check that:")- print_step(- "1. You have set GOOGLE_PSE_API_KEY and GOOGLE_PSE_ENGINE_ID in .env file"- )- print_step("2. The API key is valid and has not reached its quota")- print_step(- "3. The search engine ID is correct and the search engine is properly configured"- )- print_step(- "4. Your network connection allows access to Google APIs"- )- except Exception as e:- logger.exception("Unhandled exception in main")- print(f"Critical error: {e!s}")