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: remove 6 duplicate tests from search_engine_factory coverage files (#4254)

LearningCircuit88a03e74da6a
diff --git a/tests/web_search_engines/test_search_engine_factory_coverage.py b/tests/web_search_engines/test_search_engine_factory_coverage.py
index 2cbddae2c2..230fdb1b52 100644
--- a/tests/web_search_engines/test_search_engine_factory_coverage.py
+++ b/tests/web_search_engines/test_search_engine_factory_coverage.py
@@ -171,21 +171,6 @@ class TestApiKeyRetrieval:
assert result is not None
assert EngCls._call_kwargs["api_key"] == "from-config"
- def test_missing_api_key_returns_none(self):
- """No API key anywhere -> returns None."""
- from local_deep_research.web_search_engines.search_engine_factory import (
- create_search_engine,
- )
-
- snapshot = {"dummy": "value"}
-
- with _patches(
- config_return={"myeng": _engine_config(requires_api_key=True)},
- ):
- result = create_search_engine("myeng", settings_snapshot=snapshot)
-
- assert result is None
-
# ---------------------------------------------------------------------------
# Tests: LLM pass-through
@@ -480,22 +465,6 @@ class TestDisplayLabelFallback:
assert result is not None
- def test_unknown_engine_no_auto_returns_none(self):
- """Unknown engine with no 'auto' in config returns None."""
- from local_deep_research.web_search_engines.search_engine_factory import (
- create_search_engine,
- )
-
- with _patches(
- config_return={"other_engine": _engine_config()},
- ):
- result = create_search_engine(
- "totally_unknown",
- settings_snapshot={"x": 1},
- )
-
- assert result is None
-
def test_plain_unknown_engine_falls_back_to_auto(self):
"""Plain unknown engine name (no label format) falls back to 'auto'."""
from local_deep_research.web_search_engines.search_engine_factory import (
@@ -1105,21 +1074,6 @@ class TestGetSearchParameterRouting:
class TestExceptionHandling:
"""Test exception handling in create_search_engine."""
- def test_instantiation_exception_returns_none(self):
- """Exception during engine class instantiation returns None."""
- from local_deep_research.web_search_engines.search_engine_factory import (
- create_search_engine,
- )
-
- with _patches(
- config_return={"eng": _engine_config()},
- ) as (_, _, mock_gsmc):
- mock_gsmc.side_effect = ValueError("bad class")
-
- result = create_search_engine("eng", settings_snapshot={"x": 1})
-
- assert result is None
-
def test_engine_init_raises_returns_none(self):
"""Exception during __init__ of engine class returns None."""
from local_deep_research.web_search_engines.search_engine_factory import (
@@ -1163,22 +1117,6 @@ class TestSettingsSnapshotRequired:
"""Test that settings_snapshot=None raises RuntimeError for non-parallel,
non-retriever engines."""
- def test_none_settings_snapshot_raises(self):
- """settings_snapshot=None raises RuntimeError."""
- from local_deep_research.web_search_engines.search_engine_factory import (
- create_search_engine,
- )
-
- with patch(
- "local_deep_research.web_search_engines.search_engine_factory.retriever_registry"
- ) as mock_reg:
- mock_reg.get.return_value = None
-
- with pytest.raises(
- RuntimeError, match="settings_snapshot is required"
- ):
- create_search_engine("some_engine", settings_snapshot=None)
-
def test_parallel_does_not_need_settings_snapshot(self):
"""Parallel engines work without settings_snapshot (they short-circuit)."""
from local_deep_research.web_search_engines.search_engine_factory import (
diff --git a/tests/web_search_engines/test_search_engine_factory_deep_coverage.py b/tests/web_search_engines/test_search_engine_factory_deep_coverage.py
index cef8bf5899..aec9138980 100644
--- a/tests/web_search_engines/test_search_engine_factory_deep_coverage.py
+++ b/tests/web_search_engines/test_search_engine_factory_deep_coverage.py
@@ -15,8 +15,6 @@ Focuses on gaps not addressed by test_search_engine_factory_coverage.py:
import inspect as _inspect
from unittest.mock import MagicMock, patch
-import pytest
-
# ---------------------------------------------------------------------------
# helpers
@@ -75,21 +73,6 @@ def _make_snapshot(max_results=None, extra=None):
return snap
-# ---------------------------------------------------------------------------
-# No settings_snapshot raises RuntimeError
-# ---------------------------------------------------------------------------
-
-
-class TestNoSettingsSnapshot:
- def test_raises_runtime_error_without_snapshot(self):
- from local_deep_research.web_search_engines.search_engine_factory import (
- create_search_engine,
- )
-
- with pytest.raises(RuntimeError, match="settings_snapshot is required"):
- create_search_engine("wikipedia", settings_snapshot=None)
-
-
# ---------------------------------------------------------------------------
# parallel / parallel_scientific special paths
# ---------------------------------------------------------------------------
@@ -221,39 +204,6 @@ class TestUnknownEngineFallback:
assert result is None
-# ---------------------------------------------------------------------------
-# API key required but missing
-# ---------------------------------------------------------------------------
-
-
-class TestApiKeyRequired:
- def test_missing_api_key_returns_none(self):
- from local_deep_research.web_search_engines.search_engine_factory import (
- create_search_engine,
- )
-
- EngClass = _make_engine_class("api_key", "max_results")
- config = _minimal_config(
- "brave", EngClass, extra={"requires_api_key": True}
- )
-
- with (
- patch(
- "local_deep_research.web_search_engines.search_engine_factory.search_config",
- return_value=config,
- ),
- patch(
- "local_deep_research.web_search_engines.search_engine_factory.get_safe_module_class",
- return_value=EngClass,
- ),
- ):
- result = create_search_engine(
- "brave",
- settings_snapshot=_make_snapshot(), # no api_key in snapshot
- )
- assert result is None
-
-
# ---------------------------------------------------------------------------
# max_results default from settings_snapshot
# ---------------------------------------------------------------------------