Skip to content

~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.

test: resolve pytest-native warnings (#5156)

LearningCircuit8a013c50f7ab
diff --git a/tests/api_tests/test_all_endpoints.py b/tests/api_tests/test_all_endpoints.py
index dfe9b3b22c..c565e3eefb 100644
--- a/tests/api_tests/test_all_endpoints.py
+++ b/tests/api_tests/test_all_endpoints.py
@@ -221,8 +221,6 @@ class TestAllEndpoints:
logger.info("✅ All Research endpoints tested")
- return research_id
-
def test_all_metrics_endpoints(self, authenticated_client):
"""Test ALL metrics endpoints."""
logger.info("\n=== Testing ALL Metrics Endpoints ===")
diff --git a/tests/retriever_integration/test_factory_integration.py b/tests/retriever_integration/test_factory_integration.py
index fac74dc281..865a39a681 100644
--- a/tests/retriever_integration/test_factory_integration.py
+++ b/tests/retriever_integration/test_factory_integration.py
@@ -21,7 +21,7 @@ from local_deep_research.web_search_engines.search_engine_factory import (
_BOTH_SNAPSHOT = {"policy.egress_scope": {"value": "both"}}
-class TestRetriever(BaseRetriever):
+class DummyRetriever(BaseRetriever):
"""Test retriever."""
model_config = ConfigDict(arbitrary_types_allowed=True)
@@ -47,7 +47,7 @@ class TestFactoryIntegration:
def test_create_retriever_search_engine(self):
"""Test creating a search engine from registered retriever."""
# Register a retriever
- retriever = TestRetriever()
+ retriever = DummyRetriever()
retriever_registry.register("test_retriever", retriever)
# Create search engine
@@ -73,7 +73,7 @@ class TestFactoryIntegration:
def test_create_with_max_results(self):
"""Test creating retriever engine with max_results."""
- retriever = TestRetriever()
+ retriever = DummyRetriever()
retriever_registry.register("test", retriever)
engine = create_search_engine(
@@ -87,7 +87,7 @@ class TestFactoryIntegration:
"""Test factory can handle multiple registered retrievers."""
# Register multiple
for i in range(3):
- retriever_registry.register(f"retriever_{i}", TestRetriever())
+ retriever_registry.register(f"retriever_{i}", DummyRetriever())
# Create engines for each
engines = []
@@ -105,8 +105,8 @@ class TestFactoryIntegration:
def test_retrievers_in_search_config(self):
"""Test that registered retrievers appear in search config."""
# Register retrievers
- retriever_registry.register("custom_kb", TestRetriever())
- retriever_registry.register("vector_db", TestRetriever())
+ retriever_registry.register("custom_kb", DummyRetriever())
+ retriever_registry.register("vector_db", DummyRetriever())
# Import after registration to trigger config update
from local_deep_research.web_search_engines.search_engines_config import (
diff --git a/tests/settings/test_settings_defaults_integrity.py b/tests/settings/test_settings_defaults_integrity.py
index ff7693e6e1..9552ffeea3 100644
--- a/tests/settings/test_settings_defaults_integrity.py
+++ b/tests/settings/test_settings_defaults_integrity.py
@@ -321,7 +321,8 @@ class TestSettingsDefaultsIntegrity:
os.environ[key] = value
@pytest.fixture(scope="class")
- def defaults(self) -> dict:
+ @classmethod
+ def defaults(cls) -> dict:
return load_all_defaults()
# -- Test 1: Schema validation ------------------------------------------
diff --git a/tests/test_llm/test_llm_integration.py b/tests/test_llm/test_llm_integration.py
index 671a9f36fd..0b9cb7b109 100644
--- a/tests/test_llm/test_llm_integration.py
+++ b/tests/test_llm/test_llm_integration.py
@@ -13,7 +13,7 @@ from local_deep_research.config.llm_config import get_llm
from local_deep_research.llm import clear_llm_registry, register_llm
-class TestLLM(BaseChatModel):
+class DummyLLM(BaseChatModel):
"""Test LLM implementation."""
response_text: str = Field(default="Test response")
@@ -79,7 +79,7 @@ def full_settings_snapshot():
def test_get_llm_with_custom_provider(full_settings_snapshot):
"""Test that get_llm returns custom LLMs when registered."""
# Register a custom LLM
- custom_llm = TestLLM(response_text="Custom response")
+ custom_llm = DummyLLM(response_text="Custom response")
register_llm("custom_provider", custom_llm)
# Get LLM with custom provider
@@ -113,7 +113,7 @@ def test_get_llm_with_factory_function(full_settings_snapshot):
"kwargs": kwargs,
}
)
- return TestLLM(response_text=f"Factory LLM: {model_name}")
+ return DummyLLM(response_text=f"Factory LLM: {model_name}")
# Register the factory
register_llm("factory_provider", llm_factory)
@@ -142,7 +142,7 @@ def test_api_integration_with_custom_llm():
from local_deep_research.api import quick_summary
# Create a custom LLM
- custom_llm = TestLLM(response_text="API test response")
+ custom_llm = DummyLLM(response_text="API test response")
# Mock the necessary components
with patch(
@@ -177,8 +177,8 @@ def test_api_integration_with_custom_llm():
def test_multiple_custom_llms(full_settings_snapshot):
"""Test registering and using multiple custom LLMs."""
- llm1 = TestLLM(response_text="Response 1")
- llm2 = TestLLM(response_text="Response 2")
+ llm1 = DummyLLM(response_text="Response 1")
+ llm2 = DummyLLM(response_text="Response 2")
register_llm("provider1", llm1)
register_llm("provider2", llm2)
@@ -199,7 +199,7 @@ def test_multiple_custom_llms(full_settings_snapshot):
def test_custom_llm_with_research_context(full_settings_snapshot):
"""Test that custom LLMs receive research context properly."""
- custom_llm = TestLLM()
+ custom_llm = DummyLLM()
register_llm("context_test", custom_llm)
research_id = "test-research-123"
diff --git a/tests/web/database/test_benchmark_schema_high_value.py b/tests/web/database/test_benchmark_schema_high_value.py
index 26ee99ddf2..145e72e464 100644
--- a/tests/web/database/test_benchmark_schema_high_value.py
+++ b/tests/web/database/test_benchmark_schema_high_value.py
@@ -128,6 +128,15 @@ class TestTableDefinitions:
# ---------------------------------------------------------------------------
[email protected](scope="module")
+def db_engine():
+ """Create an in-memory SQLite engine shared by schema tests."""
+ engine = create_engine("sqlite:///:memory:")
+ create_benchmark_tables_simple(engine)
+ yield engine
+ engine.dispose()
+
+
class TestCreateBenchmarkTablesSimple:
"""Tests for actual table creation using SQLite in-memory.
@@ -136,14 +145,6 @@ class TestCreateBenchmarkTablesSimple:
cannot be re-bound to a different MetaData instance.
"""
- @pytest.fixture(scope="class")
- def db_engine(self):
- """Create an in-memory SQLite engine shared across tests in this class."""
- engine = create_engine("sqlite:///:memory:")
- create_benchmark_tables_simple(engine)
- yield engine
- engine.dispose()
-
def test_creates_all_four_tables(self, db_engine):
inspector = inspect(db_engine)
tables = inspector.get_table_names()
diff --git a/tests/web/test_thread_excepthook.py b/tests/web/test_thread_excepthook.py
index 84137ee941..127bfe1ded 100644
--- a/tests/web/test_thread_excepthook.py
+++ b/tests/web/test_thread_excepthook.py
@@ -7,6 +7,7 @@ Covers:
"""
import threading
+from types import SimpleNamespace
from unittest.mock import MagicMock, patch
@@ -20,19 +21,21 @@ def test_install_thread_excepthook_logs_uncaught_exception():
from local_deep_research.web.app import _install_thread_excepthook
previous = threading.excepthook
+ chained_hook = MagicMock()
+ threading.excepthook = chained_hook
_install_thread_excepthook()
try:
with patch("local_deep_research.web.app.logger") as mock_logger:
-
- def raiser():
- raise RuntimeError("boom from daemon")
-
- t = threading.Thread(target=raiser, name="test-daemon", daemon=True)
- t.start()
- t.join(timeout=2.0)
-
- assert not t.is_alive()
+ error = RuntimeError("boom from daemon")
+ args = SimpleNamespace(
+ exc_type=RuntimeError,
+ exc_value=error,
+ exc_traceback=error.__traceback__,
+ thread=SimpleNamespace(name="test-daemon"),
+ )
+ threading.excepthook(args)
assert mock_logger.error.called, "excepthook did not log"
+ chained_hook.assert_called_once_with(args)
logged = mock_logger.error.call_args[0][0]
assert "test-daemon" in logged