~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: Fix tests after removing deprecated get_setting_from_db_main_thread
LearningCircuit4e3672059fca
diff --git a/tests/auth_tests/conftest.py b/tests/auth_tests/conftest.pyindex 7a8d563279..402c32fdf8 100644--- a/tests/auth_tests/conftest.py+++ b/tests/auth_tests/conftest.py@@ -37,18 +37,6 @@ def reset_singletons():@pytest.fixturedef mock_settings(monkeypatch):"""Mock settings for testing."""- settings = {- "web.use_https": False, # Disable HTTPS for tests- "web.port": 5000,- "web.host": "127.0.0.1",- "web.debug": False,- }-- def mock_get_db_setting(key, default=None):- return settings.get(key, default)-- import src.local_deep_research.utilities.db_utils as db_utils-- monkeypatch.setattr(- db_utils, "get_setting_from_db_main_thread", mock_get_db_setting- )+ # Settings mocking is no longer needed since the deprecated function was removed+ # The app will use default values from environment or settings files+ passdiff --git a/tests/feature_tests/test_custom_context.py b/tests/feature_tests/test_custom_context.pyindex d79bd1ec1f..3ddb44fa78 100644--- a/tests/feature_tests/test_custom_context.py+++ b/tests/feature_tests/test_custom_context.py@@ -19,40 +19,42 @@ if src_path not in sys.path:def patch_db_setting():"""- Patch the get_db_setting function to override certain settings.+ Patch the settings retrieval to override certain settings.This simulates what would happen if we added a context_window_size setting."""# Import here to avoid module level import issues- from local_deep_research.utilities.db_utils import (- get_setting_from_db_main_thread,+ from local_deep_research.utilities.settings_utils import (+ get_setting_from_snapshot,)- original_get_db_setting = get_setting_from_db_main_thread+ original_get_setting = get_setting_from_snapshotsettings_override = {"llm.context_window_size": 8192, # Custom context window size setting}- def patched_get_db_setting(key: str, default_value: Any = None) -> Any:+ def patched_get_setting(+ key: str, default_value: Any = None, settings_snapshot=None+ ) -> Any:"""Override specific settings for testing"""if key in settings_override:return settings_override[key]- return original_get_db_setting(key, default_value)+ return original_get_setting(key, default_value, settings_snapshot)# Apply the patch- import local_deep_research.utilities.db_utils+ import local_deep_research.utilities.settings_utils- local_deep_research.utilities.db_utils.get_setting_from_db_main_thread = (- patched_get_db_setting+ local_deep_research.utilities.settings_utils.get_setting_from_snapshot = (+ patched_get_setting)# Also patch the llm_config moduleimport local_deep_research.config.llm_config- local_deep_research.config.llm_config.get_setting_from_db_main_thread = (- patched_get_db_setting+ local_deep_research.config.llm_config.get_setting_from_snapshot = (+ patched_get_setting)- return patched_get_db_setting+ return patched_get_settingdef modify_llm_creation(@@ -69,17 +71,17 @@ def modify_llm_creation(Dict containing configuration used"""# Import here to avoid module level import issues- from local_deep_research.utilities.db_utils import (- get_setting_from_db_main_thread,+ from local_deep_research.utilities.settings_utils import (+ get_setting_from_snapshot,)# Get context window size from settings- context_window_size = get_setting_from_db_main_thread(+ context_window_size = get_setting_from_snapshot("llm.context_window_size", 32000)# Get current max_tokens setting- max_tokens = get_setting_from_db_main_thread("llm.max_tokens", 30000)+ max_tokens = get_setting_from_snapshot("llm.max_tokens", 30000)logger.info(f"Provider: {provider}")logger.info(f"Context window size from settings: {context_window_size}")diff --git a/tests/rate_limiting/test_rate_limiting.py b/tests/rate_limiting/test_rate_limiting.pyindex 9173ce780a..83156ffe42 100644--- a/tests/rate_limiting/test_rate_limiting.py+++ b/tests/rate_limiting/test_rate_limiting.py@@ -28,12 +28,14 @@ class TestAdaptiveRateLimitTracker(unittest.TestCase):# Note: Using the main database - in a real test environment# you'd want to mock the database session- # Force settings manager to use default settings instead of reading- # from the DB. This makes things more reliable.+ # Force settings to use default values+ # The deprecated function has been removedwith patch(- "src.local_deep_research.utilities.db_utils"- ".get_setting_from_db_main_thread",- side_effect=lambda key, default=None: default,+ "src.local_deep_research.utilities.settings_utils"+ ".get_setting_from_snapshot",+ side_effect=lambda key,+ default=None,+ settings_snapshot=None: default,):self.tracker = AdaptiveRateLimitTracker()diff --git a/tests/test_search_engines_enhanced.py b/tests/test_search_engines_enhanced.pyindex b70af1785b..705a82a905 100644--- a/tests/test_search_engines_enhanced.py+++ b/tests/test_search_engines_enhanced.py@@ -339,8 +339,10 @@ class TestMultipleSearchEngines:WikipediaSearchEngine as SearchEngine,)elif engine_name == "google_pse":- # Mock db_utils.get_db_setting to return test credentials- def mock_get_db_setting(key, default=None):+ # Mock settings snapshot for Google PSE+ def mock_get_setting_from_snapshot(+ key, default=None, settings_snapshot=None+ ):if "api_key" in key:return "test_api_key"elif "engine_id" in key:@@ -348,8 +350,8 @@ class TestMultipleSearchEngines:return defaultmonkeypatch.setattr(- "src.local_deep_research.utilities.db_utils.get_setting_from_db_main_thread",- mock_get_db_setting,+ "src.local_deep_research.utilities.settings_utils.get_setting_from_snapshot",+ mock_get_setting_from_snapshot,)# Also set environment variables as fallbackmonkeypatch.setenv("GOOGLE_PSE_API_KEY", "test_api_key")