~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
refactor(tests): split @integration classes out of engine/mcp mixed files (#3609)
LearningCircuit1669eb4ab0af
diff --git a/tests/mcp/test_mcp_client_server_integration.py b/tests/mcp/test_mcp_client_server_integration.pyindex b57fe028d4..2f873f4d0d 100644--- a/tests/mcp/test_mcp_client_server_integration.py+++ b/tests/mcp/test_mcp_client_server_integration.py@@ -1,17 +1,11 @@-"""-Integration tests for MCP client-server communication.--These tests verify the MCP client functionality through a combination of:-1. Mock-based tests for fast, deterministic testing of client logic-2. Subprocess tests (marked with `integration`) for end-to-end verification+"""Fast mock-based tests for MCP client logic.-To run the subprocess tests locally:- pytest tests/mcp/test_mcp_client_server_integration.py -m integration+The subprocess-based integration tests (spawning a real echo server)+now live at tests/performance/mcp/test_mcp_client_server_live.py —+co-located with the echo_server.py they rely on."""import asyncio-import sys-from pathlib import Pathfrom unittest.mock import AsyncMock, MagicMock, patchimport pytest@@ -28,9 +22,6 @@ pytestmark = pytest.mark.skipif(not MCP_AVAILABLE, reason="MCP package not installed")-# Path to the echo server for testing-ECHO_SERVER_PATH = Path(__file__).parent / "echo_server.py"-class TestMCPClientWithMockedSession:"""Tests for MCPClient using mocked session for fast, reliable testing."""@@ -193,187 +184,6 @@ class TestMCPClientWithMockedSession:assert call_count == 3-# =============================================================================-# Subprocess-based integration tests - marked for opt-in execution-# These tests spawn actual MCP servers and test real communication-# =============================================================================---class TestRealMCPClientServerCommunication:- """Tests for actual MCP client-server communication via subprocess.-- These tests are slower and require subprocess spawning. Run with:- pytest -m integration- """-- @pytest.fixture- def echo_server_config(self):- """Configuration for the echo test server."""- return {- "name": "echo-test",- "command": sys.executable,- "args": [str(ECHO_SERVER_PATH)],- }-- @pytest.mark.asyncio- async def test_connect_to_echo_server(self, echo_server_config):- """Test connecting to the echo server subprocess."""- from local_deep_research.mcp.client import MCPClient-- client = MCPClient(echo_server_config, timeout=60.0)-- async with client.connect() as connected:- assert connected._connected is True-- @pytest.mark.asyncio- async def test_list_tools_from_echo_server(self, echo_server_config):- """Test listing tools from the running echo server."""- from local_deep_research.mcp.client import MCPClient-- client = MCPClient(echo_server_config, timeout=60.0)-- async with client.connect() as connected:- tools = await connected.list_tools()-- # Verify we got the expected tools- tool_names = [t["name"] for t in tools]- assert "echo" in tool_names- assert "add_numbers" in tool_names- assert "get_info" in tool_names-- @pytest.mark.asyncio- async def test_call_echo_tool(self, echo_server_config):- """Test calling the echo tool on the real server."""- from local_deep_research.mcp.client import MCPClient-- client = MCPClient(echo_server_config, timeout=60.0)-- async with client.connect() as connected:- result = await connected.call_tool(- "echo", {"message": "Hello, MCP!"}- )-- assert result["status"] == "success"- # The content should contain the echoed message- assert "Hello, MCP!" in result["content"]-- @pytest.mark.asyncio- async def test_call_add_numbers_tool(self, echo_server_config):- """Test calling the add_numbers tool."""- from local_deep_research.mcp.client import MCPClient-- client = MCPClient(echo_server_config, timeout=60.0)-- async with client.connect() as connected:- result = await connected.call_tool("add_numbers", {"a": 5, "b": 3})-- assert result["status"] == "success"- # Result should contain 8- assert "8" in result["content"]-- @pytest.mark.asyncio- async def test_call_get_info_tool(self, echo_server_config):- """Test calling the get_info tool."""- from local_deep_research.mcp.client import MCPClient-- client = MCPClient(echo_server_config, timeout=60.0)-- async with client.connect() as connected:- result = await connected.call_tool("get_info", {})-- assert result["status"] == "success"- assert "echo-test-server" in result["content"]-- @pytest.mark.asyncio- async def test_multiple_tool_calls_sequential(self, echo_server_config):- """Test multiple sequential tool calls on one connection."""- from local_deep_research.mcp.client import MCPClient-- client = MCPClient(echo_server_config, timeout=60.0)-- async with client.connect() as connected:- # Call multiple tools sequentially- result1 = await connected.call_tool("echo", {"message": "First"})- result2 = await connected.call_tool(- "add_numbers", {"a": 10, "b": 20}- )- result3 = await connected.call_tool("echo", {"message": "Third"})-- assert result1["status"] == "success"- assert "First" in result1["content"]- assert result2["status"] == "success"- assert "30" in result2["content"]- assert result3["status"] == "success"- assert "Third" in result3["content"]-- @pytest.mark.asyncio- async def test_connection_context_manager_cleanup(self, echo_server_config):- """Test that connection is properly cleaned up after context exit."""- from local_deep_research.mcp.client import MCPClient-- client = MCPClient(echo_server_config, timeout=60.0)-- async with client.connect() as connected:- assert connected._connected is True-- # After context exit, should be disconnected- assert client._connected is False- assert client._session is None---class TestMCPClientServerErrorHandling:- """Tests for error handling in real client-server communication."""-- @pytest.fixture- def echo_server_config(self):- """Configuration for the echo test server."""- return {- "name": "echo-test",- "command": sys.executable,- "args": [str(ECHO_SERVER_PATH)],- }-- @pytest.mark.asyncio- async def test_tool_error_handling(self, echo_server_config):- """Test handling of errors from tools."""- from local_deep_research.mcp.client import MCPClient-- client = MCPClient(echo_server_config, timeout=60.0)-- async with client.connect() as connected:- # Request the tool to fail intentionally- result = await connected.call_tool(- "fail_on_demand",- {"should_fail": True, "error_message": "Test failure"},- )-- # The MCP SDK returns error results, not exceptions for tool errors- # Check if the result indicates an error- assert (- result["status"] == "error"- or "error" in result.get("content", "").lower()- )-- @pytest.mark.asyncio- async def test_connection_to_invalid_command(self):- """Test connection failure for invalid command."""- from local_deep_research.mcp.client import MCPClient, MCPClientError-- config = {- "name": "invalid",- "command": "python",- "args": ["/nonexistent/path/to/server.py"],- }-- client = MCPClient(config, timeout=10.0)-- with pytest.raises(MCPClientError):- async with client.connect():- pass # Should not reach here--class TestMCPClientValidation:"""Tests for client configuration validation with real commands."""diff --git a/tests/performance/mcp/test_mcp_client_server_live.py b/tests/performance/mcp/test_mcp_client_server_live.pynew file mode 100644index 0000000000..a2777d0b1d--- /dev/null+++ b/tests/performance/mcp/test_mcp_client_server_live.py@@ -0,0 +1,208 @@+"""Live MCP client-server integration tests (subprocess-spawned server).++Hit a real MCP echo-server subprocess — excluded from CI via `-m 'not integration'`.+Run locally with:++ pdm run pytest tests/performance/mcp/test_mcp_client_server_live.py -v -m integration+"""++import sys+from pathlib import Path++import pytest++# Skip all tests if MCP is not available+try:+ import mcp # noqa: F401++ MCP_AVAILABLE = True+except ImportError:+ MCP_AVAILABLE = False++pytestmark = pytest.mark.skipif(+ not MCP_AVAILABLE, reason="MCP package not installed"+)++# Path to the echo server (co-located with this file).+ECHO_SERVER_PATH = Path(__file__).parent / "echo_server.py"+++# =============================================================================+# Subprocess-based integration tests - marked for opt-in execution+# These tests spawn actual MCP servers and test real communication+# =============================================================================+++class TestRealMCPClientServerCommunication:+ """Tests for actual MCP client-server communication via subprocess.++ These tests are slower and require subprocess spawning. Run with:+ pytest -m integration+ """++ @pytest.fixture+ def echo_server_config(self):+ """Configuration for the echo test server."""+ return {+ "name": "echo-test",+ "command": sys.executable,+ "args": [str(ECHO_SERVER_PATH)],+ }++ @pytest.mark.asyncio+ async def test_connect_to_echo_server(self, echo_server_config):+ """Test connecting to the echo server subprocess."""+ from local_deep_research.mcp.client import MCPClient++ client = MCPClient(echo_server_config, timeout=60.0)++ async with client.connect() as connected:+ assert connected._connected is True++ @pytest.mark.asyncio+ async def test_list_tools_from_echo_server(self, echo_server_config):+ """Test listing tools from the running echo server."""+ from local_deep_research.mcp.client import MCPClient++ client = MCPClient(echo_server_config, timeout=60.0)++ async with client.connect() as connected:+ tools = await connected.list_tools()++ # Verify we got the expected tools+ tool_names = [t["name"] for t in tools]+ assert "echo" in tool_names+ assert "add_numbers" in tool_names+ assert "get_info" in tool_names++ @pytest.mark.asyncio+ async def test_call_echo_tool(self, echo_server_config):+ """Test calling the echo tool on the real server."""+ from local_deep_research.mcp.client import MCPClient++ client = MCPClient(echo_server_config, timeout=60.0)++ async with client.connect() as connected:+ result = await connected.call_tool(+ "echo", {"message": "Hello, MCP!"}+ )++ assert result["status"] == "success"+ # The content should contain the echoed message+ assert "Hello, MCP!" in result["content"]++ @pytest.mark.asyncio+ async def test_call_add_numbers_tool(self, echo_server_config):+ """Test calling the add_numbers tool."""+ from local_deep_research.mcp.client import MCPClient++ client = MCPClient(echo_server_config, timeout=60.0)++ async with client.connect() as connected:+ result = await connected.call_tool("add_numbers", {"a": 5, "b": 3})++ assert result["status"] == "success"+ # Result should contain 8+ assert "8" in result["content"]++ @pytest.mark.asyncio+ async def test_call_get_info_tool(self, echo_server_config):+ """Test calling the get_info tool."""+ from local_deep_research.mcp.client import MCPClient++ client = MCPClient(echo_server_config, timeout=60.0)++ async with client.connect() as connected:+ result = await connected.call_tool("get_info", {})++ assert result["status"] == "success"+ assert "echo-test-server" in result["content"]++ @pytest.mark.asyncio+ async def test_multiple_tool_calls_sequential(self, echo_server_config):+ """Test multiple sequential tool calls on one connection."""+ from local_deep_research.mcp.client import MCPClient++ client = MCPClient(echo_server_config, timeout=60.0)++ async with client.connect() as connected:+ # Call multiple tools sequentially+ result1 = await connected.call_tool("echo", {"message": "First"})+ result2 = await connected.call_tool(+ "add_numbers", {"a": 10, "b": 20}+ )+ result3 = await connected.call_tool("echo", {"message": "Third"})++ assert result1["status"] == "success"+ assert "First" in result1["content"]+ assert result2["status"] == "success"+ assert "30" in result2["content"]+ assert result3["status"] == "success"+ assert "Third" in result3["content"]++ @pytest.mark.asyncio+ async def test_connection_context_manager_cleanup(self, echo_server_config):+ """Test that connection is properly cleaned up after context exit."""+ from local_deep_research.mcp.client import MCPClient++ client = MCPClient(echo_server_config, timeout=60.0)++ async with client.connect() as connected:+ assert connected._connected is True++ # After context exit, should be disconnected+ assert client._connected is False+ assert client._session is None+++class TestMCPClientServerErrorHandling:+ """Tests for error handling in real client-server communication."""++ @pytest.fixture+ def echo_server_config(self):+ """Configuration for the echo test server."""+ return {+ "name": "echo-test",+ "command": sys.executable,+ "args": [str(ECHO_SERVER_PATH)],+ }++ @pytest.mark.asyncio+ async def test_tool_error_handling(self, echo_server_config):+ """Test handling of errors from tools."""+ from local_deep_research.mcp.client import MCPClient++ client = MCPClient(echo_server_config, timeout=60.0)++ async with client.connect() as connected:+ # Request the tool to fail intentionally+ result = await connected.call_tool(+ "fail_on_demand",+ {"should_fail": True, "error_message": "Test failure"},+ )++ # The MCP SDK returns error results, not exceptions for tool errors+ # Check if the result indicates an error+ assert (+ result["status"] == "error"+ or "error" in result.get("content", "").lower()+ )++ @pytest.mark.asyncio+ async def test_connection_to_invalid_command(self):+ """Test connection failure for invalid command."""+ from local_deep_research.mcp.client import MCPClient, MCPClientError++ config = {+ "name": "invalid",+ "command": "python",+ "args": ["/nonexistent/path/to/server.py"],+ }++ client = MCPClient(config, timeout=10.0)++ with pytest.raises(MCPClientError):+ async with client.connect():+ pass # Should not reach herediff --git a/tests/performance/search_engines/test_search_engine_gutenberg_live.py b/tests/performance/search_engines/test_search_engine_gutenberg_live.pynew file mode 100644index 0000000000..b04afe6051--- /dev/null+++ b/tests/performance/search_engines/test_search_engine_gutenberg_live.py@@ -0,0 +1,131 @@+"""Live Project Gutenberg via Gutendex API integration tests.++Hit real network APIs — excluded from CI via `-m 'not integration'`.+Run locally with:++ pdm run pytest tests/performance/search_engines/test_search_engine_gutenberg_live.py -v+"""++import pytest+++class TestGutenbergIntegration:+ """Integration tests making real API calls to Gutendex."""++ def test_real_search_sherlock_holmes(self):+ """Test real search for Sherlock Holmes."""+ from local_deep_research.web_search_engines.engines.search_engine_gutenberg import (+ GutenbergSearchEngine,+ )++ engine = GutenbergSearchEngine(max_results=5)+ results = engine._get_previews("sherlock holmes")++ # Verify we got results+ assert len(results) > 0, "Should find Sherlock Holmes books"++ # Verify result structure+ for r in results:+ assert "title" in r, "Each result should have a title"+ assert "link" in r, "Each result should have a link"+ assert r["source"] == "Project Gutenberg"+ assert "gutenberg.org" in r["link"], "Link should be Gutenberg URL"++ # Verify at least one is actually Sherlock Holmes+ titles = [r["title"].lower() for r in results]+ assert any("sherlock" in t or "holmes" in t for t in titles), (+ f"Should find Sherlock Holmes, got: {titles}"+ )++ def test_real_search_finds_doyle(self):+ """Test that Sherlock Holmes search finds Arthur Conan Doyle."""+ from local_deep_research.web_search_engines.engines.search_engine_gutenberg import (+ GutenbergSearchEngine,+ )++ engine = GutenbergSearchEngine(max_results=5)+ results = engine._get_previews("sherlock holmes doyle")++ assert len(results) > 0, "Should find results"++ # At least one should have Doyle as author+ found_doyle = False+ for r in results:+ for author in r.get("authors", []):+ if "doyle" in author.lower():+ found_doyle = True+ break+ assert found_doyle, (+ f"Should find Doyle as author, got: {[r.get('authors') for r in results]}"+ )++ def test_real_search_pride_and_prejudice(self):+ """Test real search for Pride and Prejudice."""+ from local_deep_research.web_search_engines.engines.search_engine_gutenberg import (+ GutenbergSearchEngine,+ )++ engine = GutenbergSearchEngine(max_results=5)+ results = engine._get_previews("pride and prejudice austen")++ assert len(results) > 0, "Should find Pride and Prejudice"++ # Check for Jane Austen+ found_austen = False+ for r in results:+ for author in r.get("authors", []):+ if "austen" in author.lower():+ found_austen = True+ break+ assert found_austen, (+ f"Should find Austen, got: {[r.get('authors') for r in results]}"+ )++ def test_real_search_returns_download_count(self):+ """Test that real search returns download counts."""+ from local_deep_research.web_search_engines.engines.search_engine_gutenberg import (+ GutenbergSearchEngine,+ )++ engine = GutenbergSearchEngine(max_results=3)+ results = engine._get_previews("moby dick")++ assert len(results) > 0, "Should find Moby Dick"++ # Popular books should have download counts+ first = results[0]+ assert "download_count" in first, "Should have download_count"+ assert first["download_count"] > 0, "Popular book should have downloads"++ def test_real_search_with_language_filter(self):+ """Test real search with English language filter."""+ from local_deep_research.web_search_engines.engines.search_engine_gutenberg import (+ GutenbergSearchEngine,+ )++ engine = GutenbergSearchEngine(max_results=5, languages="en")+ results = engine._get_previews("sherlock holmes")++ assert len(results) > 0, "Should find English Sherlock Holmes books"++ # All results should have English+ for r in results:+ assert "en" in r.get("languages", []), (+ f"Should be English, got languages: {r.get('languages')}"+ )++ def test_real_search_has_read_url(self):+ """Test that results include read URLs."""+ from local_deep_research.web_search_engines.engines.search_engine_gutenberg import (+ GutenbergSearchEngine,+ )++ engine = GutenbergSearchEngine(max_results=3)+ results = engine._get_previews("frankenstein")++ assert len(results) > 0, "Should find Frankenstein"++ # At least one should have a read URL+ has_read_url = any(r.get("read_url") for r in results)+ assert has_read_url, "At least one result should have read_url"diff --git a/tests/performance/search_engines/test_search_engine_openlibrary_live.py b/tests/performance/search_engines/test_search_engine_openlibrary_live.pynew file mode 100644index 0000000000..19d85dcbc9--- /dev/null+++ b/tests/performance/search_engines/test_search_engine_openlibrary_live.py@@ -0,0 +1,121 @@+"""Live Open Library API integration tests.++Hit real network APIs — excluded from CI via `-m 'not integration'`.+Run locally with:++ pdm run pytest tests/performance/search_engines/test_search_engine_openlibrary_live.py -v+"""++import pytest+++class TestOpenLibraryIntegration:+ """Integration tests making real API calls to Open Library."""++ def test_real_search_harry_potter(self):+ """Test real search for Harry Potter books."""+ from local_deep_research.web_search_engines.engines.search_engine_openlibrary import (+ OpenLibrarySearchEngine,+ )++ engine = OpenLibrarySearchEngine(max_results=5)+ results = engine._get_previews("harry potter")++ # Verify we got results+ assert len(results) > 0, "Should find Harry Potter books"++ # Verify result structure+ for r in results:+ assert "title" in r, "Each result should have a title"+ assert "link" in r, "Each result should have a link"+ assert r["source"] == "Open Library", (+ "Source should be Open Library"+ )+ assert r["link"].startswith("https://openlibrary.org"), (+ "Link should be valid"+ )++ # Verify at least one result mentions Harry Potter+ titles = [r["title"].lower() for r in results]+ assert any("harry potter" in t or "potter" in t for t in titles), (+ f"At least one result should contain 'Harry Potter', got: {titles}"+ )++ def test_real_author_search_stephen_king(self):+ """Test real author search for Stephen King."""+ from local_deep_research.web_search_engines.engines.search_engine_openlibrary import (+ OpenLibrarySearchEngine,+ )++ engine = OpenLibrarySearchEngine(max_results=5, search_field="author")+ results = engine._get_previews("Stephen King")++ # Verify we got results+ assert len(results) > 0, "Should find Stephen King books"++ # Verify at least one result has Stephen King as author+ found_king = False+ for r in results:+ authors = r.get("authors", [])+ for author in authors:+ if "king" in author.lower():+ found_king = True+ break+ assert found_king, (+ f"At least one result should have King as author, got: {[r.get('authors') for r in results]}"+ )++ def test_real_title_search_1984(self):+ """Test real title search for 1984."""+ from local_deep_research.web_search_engines.engines.search_engine_openlibrary import (+ OpenLibrarySearchEngine,+ )++ engine = OpenLibrarySearchEngine(max_results=5, search_field="title")+ results = engine._get_previews("1984")++ # Verify we got results+ assert len(results) > 0, "Should find books with 1984 in title"++ # Verify result has expected fields+ first = results[0]+ assert "title" in first+ assert "authors" in first+ assert "link" in first++ def test_real_search_returns_metadata(self):+ """Test that real search returns proper metadata."""+ from local_deep_research.web_search_engines.engines.search_engine_openlibrary import (+ OpenLibrarySearchEngine,+ )++ engine = OpenLibrarySearchEngine(max_results=3)+ results = engine._get_previews("lord of the rings tolkien")++ assert len(results) > 0, "Should find Lord of the Rings"++ # Check first result has expected metadata+ first = results[0]+ assert first.get("title"), "Should have title"+ assert first.get("authors"), "Should have authors"+ assert first.get("link"), "Should have link"+ assert first.get("id"), "Should have id"++ # Verify it's actually Tolkien+ authors = first.get("authors", [])+ assert any("tolkien" in a.lower() for a in authors), (+ f"Should find Tolkien as author, got: {authors}"+ )++ def test_real_search_with_language_filter(self):+ """Test real search with language filter."""+ from local_deep_research.web_search_engines.engines.search_engine_openlibrary import (+ OpenLibrarySearchEngine,+ )++ engine = OpenLibrarySearchEngine(max_results=5, language="eng")+ results = engine._get_previews("science fiction")++ assert len(results) > 0, "Should find science fiction books in English"+ assert all(r["source"] == "Open Library" for r in results)diff --git a/tests/performance/search_engines/test_search_engine_pubchem_live.py b/tests/performance/search_engines/test_search_engine_pubchem_live.pynew file mode 100644index 0000000000..887e47c345--- /dev/null+++ b/tests/performance/search_engines/test_search_engine_pubchem_live.py@@ -0,0 +1,137 @@+"""Live PubChem API integration tests.++Hit real network APIs — excluded from CI via `-m 'not integration'`.+Run locally with:++ pdm run pytest tests/performance/search_engines/test_search_engine_pubchem_live.py -v+"""++import pytest+++class TestPubChemIntegration:+ """Integration tests making real API calls to PubChem."""++ def test_real_search_aspirin(self):+ """Test real search for aspirin."""+ from local_deep_research.web_search_engines.engines.search_engine_pubchem import (+ PubChemSearchEngine,+ )++ engine = PubChemSearchEngine(max_results=3)+ results = engine._get_previews("aspirin")++ # Verify we got results+ assert len(results) > 0, "Should find aspirin"++ # Verify first result+ first = results[0]+ assert "title" in first, "Should have title"+ assert "link" in first, "Should have link"+ assert first["source"] == "PubChem", "Source should be PubChem"+ assert "pubchem.ncbi.nlm.nih.gov" in first["link"], (+ "Link should be PubChem URL"+ )++ def test_real_search_returns_molecular_formula(self):+ """Test that real search returns molecular formula."""+ from local_deep_research.web_search_engines.engines.search_engine_pubchem import (+ PubChemSearchEngine,+ )++ engine = PubChemSearchEngine(max_results=1)+ results = engine._get_previews("caffeine")++ assert len(results) > 0, "Should find caffeine"++ first = results[0]+ assert first.get("molecular_formula"), "Should have molecular_formula"+ # Caffeine is C8H10N4O2+ assert "C" in first["molecular_formula"], "Formula should contain C"++ def test_real_search_returns_molecular_weight(self):+ """Test that real search returns molecular weight."""+ from local_deep_research.web_search_engines.engines.search_engine_pubchem import (+ PubChemSearchEngine,+ )++ engine = PubChemSearchEngine(max_results=1)+ results = engine._get_previews("glucose")++ assert len(results) > 0, "Should find glucose"++ first = results[0]+ assert first.get("molecular_weight"), "Should have molecular_weight"+ # Just verify molecular weight is a positive number+ # (PubChem may return different glucose compounds like derivatives)+ weight = float(first["molecular_weight"])+ assert weight > 0, f"Molecular weight should be positive, got {weight}"++ def test_real_search_returns_smiles(self):+ """Test that real search returns SMILES notation."""+ from local_deep_research.web_search_engines.engines.search_engine_pubchem import (+ PubChemSearchEngine,+ )++ engine = PubChemSearchEngine(max_results=1)+ results = engine._get_previews("ethanol")++ assert len(results) > 0, "Should find ethanol"++ first = results[0]+ assert first.get("smiles"), "Should have SMILES"+ # Ethanol SMILES should contain C and O+ assert "C" in first["smiles"] and "O" in first["smiles"], (+ f"Ethanol SMILES should contain C and O, got: {first['smiles']}"+ )++ def test_real_search_returns_cid(self):+ """Test that real search returns compound ID."""+ from local_deep_research.web_search_engines.engines.search_engine_pubchem import (+ PubChemSearchEngine,+ )++ engine = PubChemSearchEngine(max_results=1)+ results = engine._get_previews("water")++ assert len(results) > 0, "Should find water"++ first = results[0]+ assert first.get("cid"), "Should have CID"+ assert isinstance(first["cid"], int), "CID should be integer"++ def test_real_search_ibuprofen(self):+ """Test real search for ibuprofen."""+ from local_deep_research.web_search_engines.engines.search_engine_pubchem import (+ PubChemSearchEngine,+ )++ engine = PubChemSearchEngine(max_results=1)+ results = engine._get_previews("ibuprofen")++ assert len(results) > 0, "Should find ibuprofen"++ first = results[0]+ # Ibuprofen CID is 3672+ assert first.get("cid"), "Should have CID"+ assert first.get("iupac_name"), "Should have IUPAC name"++ def test_real_search_partial_name(self):+ """Test real search with partial compound name."""+ from local_deep_research.web_search_engines.engines.search_engine_pubchem import (+ PubChemSearchEngine,+ )++ engine = PubChemSearchEngine(max_results=5)+ results = engine._get_previews("acet")++ # Should find compounds starting with "acet" like acetone, acetamide, etc.+ assert len(results) > 0, "Should find compounds starting with 'acet'"++ # At least one should have a title starting with "acet"+ titles = [r["title"].lower() for r in results]+ has_acet = any("acet" in t for t in titles)+ assert has_acet, (+ f"Should find compound starting with 'acet', got: {titles}"+ )diff --git a/tests/performance/search_engines/test_search_engine_stackexchange_live.py b/tests/performance/search_engines/test_search_engine_stackexchange_live.pynew file mode 100644index 0000000000..5431019f82--- /dev/null+++ b/tests/performance/search_engines/test_search_engine_stackexchange_live.py@@ -0,0 +1,136 @@+"""Live Stack Exchange API integration tests.++Hit real network APIs — excluded from CI via `-m 'not integration'`.+Run locally with:++ pdm run pytest tests/performance/search_engines/test_search_engine_stackexchange_live.py -v+"""++import pytest+++class TestStackExchangeIntegration:+ """Integration tests making real API calls to Stack Exchange."""++ def test_real_search_python(self):+ """Test real search for Python questions."""+ from local_deep_research.web_search_engines.engines.search_engine_stackexchange import (+ StackExchangeSearchEngine,+ )++ engine = StackExchangeSearchEngine(max_results=5)+ results = engine._get_previews("python list comprehension")++ # Verify we got results+ assert len(results) > 0, "Should find Python questions"++ # Verify result structure+ for r in results:+ assert "title" in r, "Each result should have a title"+ assert "link" in r, "Each result should have a link"+ assert r["source"] == "Stack Overflow", (+ "Source should be Stack Overflow"+ )+ assert "stackoverflow.com" in r["link"], "Link should be SO URL"++ def test_real_search_returns_scores(self):+ """Test that real search returns scores."""+ from local_deep_research.web_search_engines.engines.search_engine_stackexchange import (+ StackExchangeSearchEngine,+ )++ engine = StackExchangeSearchEngine(max_results=5)+ results = engine._get_previews("javascript async await")++ assert len(results) > 0, "Should find JavaScript questions"++ # All should have score+ for r in results:+ assert "score" in r, "Should have score"+ assert isinstance(r["score"], int), "Score should be int"++ def test_real_search_returns_tags(self):+ """Test that real search returns tags."""+ from local_deep_research.web_search_engines.engines.search_engine_stackexchange import (+ StackExchangeSearchEngine,+ )++ engine = StackExchangeSearchEngine(max_results=5)+ results = engine._get_previews("react hooks")++ assert len(results) > 0, "Should find React questions"++ # At least some should have tags+ has_tags = any(r.get("tags") for r in results)+ assert has_tags, (+ f"At least one should have tags, got: {[r.get('tags') for r in results]}"+ )++ def test_real_search_different_site(self):+ """Test real search on different Stack Exchange site."""+ from local_deep_research.web_search_engines.engines.search_engine_stackexchange import (+ StackExchangeSearchEngine,+ )++ engine = StackExchangeSearchEngine(max_results=5, site="unix")+ results = engine._get_previews("bash script loop")++ assert len(results) > 0, "Should find Unix questions"++ # Source should reflect the site+ assert results[0]["source"] == "Unix & Linux", (+ f"Source should be Unix & Linux, got: {results[0]['source']}"+ )+ assert results[0]["site"] == "unix"++ def test_real_search_with_high_score(self):+ """Test real search with minimum score filter."""+ from local_deep_research.web_search_engines.engines.search_engine_stackexchange import (+ StackExchangeSearchEngine,+ )++ engine = StackExchangeSearchEngine(+ max_results=5, min_score=100, sort="votes"+ )+ results = engine._get_previews("python")++ assert len(results) > 0, "Should find high-score Python questions"++ # All should have score >= 100+ for r in results:+ assert r["score"] >= 100, (+ f"Score should be >= 100, got: {r['score']}"+ )++ def test_real_search_returns_answer_count(self):+ """Test that real search returns answer counts."""+ from local_deep_research.web_search_engines.engines.search_engine_stackexchange import (+ StackExchangeSearchEngine,+ )++ engine = StackExchangeSearchEngine(max_results=5, has_answers=True)+ results = engine._get_previews("docker container")++ assert len(results) > 0, "Should find Docker questions with answers"++ # All should have at least one answer+ for r in results:+ assert r["answer_count"] >= 1, (+ f"Should have answers, got: {r['answer_count']}"+ )++ def test_real_search_returns_author_info(self):+ """Test that real search returns author information."""+ from local_deep_research.web_search_engines.engines.search_engine_stackexchange import (+ StackExchangeSearchEngine,+ )++ engine = StackExchangeSearchEngine(max_results=5)+ results = engine._get_previews("git merge conflict")++ assert len(results) > 0, "Should find Git questions"++ # At least some should have author+ has_author = any(r.get("author") for r in results)+ assert has_author, "At least one should have author"diff --git a/tests/performance/search_engines/test_search_engine_zenodo_live.py b/tests/performance/search_engines/test_search_engine_zenodo_live.pynew file mode 100644index 0000000000..eb501e46b8--- /dev/null+++ b/tests/performance/search_engines/test_search_engine_zenodo_live.py@@ -0,0 +1,129 @@+"""Live Zenodo API integration tests.++Hit real network APIs — excluded from CI via `-m 'not integration'`.+Run locally with:++ pdm run pytest tests/performance/search_engines/test_search_engine_zenodo_live.py -v+"""++import pytest+++class TestZenodoIntegration:+ """Integration tests making real API calls to Zenodo.++ Note: These tests depend on external Zenodo API availability.+ They handle empty results gracefully since API may be rate-limited in CI.+ """++ def test_real_search_machine_learning(self):+ """Test real search for machine learning datasets."""+ from local_deep_research.web_search_engines.engines.search_engine_zenodo import (+ ZenodoSearchEngine,+ )++ engine = ZenodoSearchEngine(max_results=5)+ results = engine._get_previews("machine learning")++ # API may be rate-limited; verify structure if results returned+ if len(results) > 0:+ for r in results:+ assert "title" in r, "Each result should have a title"+ assert "link" in r, "Each result should have a link"+ assert r["source"] == "Zenodo", "Source should be Zenodo"+ assert "zenodo.org" in r["link"], "Link should be Zenodo URL"++ def test_real_search_returns_doi(self):+ """Test that real search returns DOIs."""+ from local_deep_research.web_search_engines.engines.search_engine_zenodo import (+ ZenodoSearchEngine,+ )++ engine = ZenodoSearchEngine(max_results=5)+ results = engine._get_previews("climate data")++ # API may be rate-limited; verify DOI if results returned+ if len(results) > 0:+ has_doi = any(r.get("doi") for r in results)+ assert has_doi, "At least one result should have a DOI"++ def test_real_search_datasets(self):+ """Test real search filtered to datasets."""+ from local_deep_research.web_search_engines.engines.search_engine_zenodo import (+ ZenodoSearchEngine,+ )++ engine = ZenodoSearchEngine(max_results=5, resource_type="dataset")+ results = engine._get_previews("genomics")++ # API may be rate-limited; verify type if results returned+ if len(results) > 0:+ for r in results:+ assert r.get("resource_type") in [+ "Dataset",+ "dataset",+ "Other",+ ], f"Should be dataset type, got: {r.get('resource_type')}"++ def test_real_search_software(self):+ """Test real search filtered to software."""+ from local_deep_research.web_search_engines.engines.search_engine_zenodo import (+ ZenodoSearchEngine,+ )++ engine = ZenodoSearchEngine(max_results=5, resource_type="software")+ results = engine._get_previews("python")++ # API may be rate-limited; verify links if results returned+ if len(results) > 0:+ for r in results:+ assert r["link"].startswith("https://zenodo.org"), (+ f"Link should be Zenodo URL: {r['link']}"+ )++ def test_real_search_returns_authors(self):+ """Test that real search returns authors."""+ from local_deep_research.web_search_engines.engines.search_engine_zenodo import (+ ZenodoSearchEngine,+ )++ engine = ZenodoSearchEngine(max_results=5)+ results = engine._get_previews("neural network")++ # API may be rate-limited; verify authors if results returned+ if len(results) > 0:+ has_authors = any(r.get("authors") for r in results)+ assert has_authors, (+ f"At least one should have authors, got: {[r.get('authors') for r in results]}"+ )++ def test_real_search_open_access(self):+ """Test real search for open access records."""+ from local_deep_research.web_search_engines.engines.search_engine_zenodo import (+ ZenodoSearchEngine,+ )++ engine = ZenodoSearchEngine(max_results=5, access_right="open")+ results = engine._get_previews("biology")++ # API may be rate-limited; verify access_right if results returned+ if len(results) > 0:+ for r in results:+ assert r.get("access_right") == "open", (+ f"Should be open access, got: {r.get('access_right')}"+ )++ def test_real_search_returns_publication_date(self):+ """Test that real search returns publication dates."""+ from local_deep_research.web_search_engines.engines.search_engine_zenodo import (+ ZenodoSearchEngine,+ )++ engine = ZenodoSearchEngine(max_results=5)+ results = engine._get_previews("astronomy")++ # API may be rate-limited; verify publication_date if results returned+ if len(results) > 0:+ has_date = any(r.get("publication_date") for r in results)+ assert has_date, "At least one should have publication_date"diff --git a/tests/search_engines/test_search_engine_gutenberg.py b/tests/search_engines/test_search_engine_gutenberg.pyindex e6209502e6..c2be9d5626 100644--- a/tests/search_engines/test_search_engine_gutenberg.py+++ b/tests/search_engines/test_search_engine_gutenberg.py@@ -466,125 +466,3 @@ class TestGutenbergFullContent:assert "Authors: Author One" in results[0]["content"]assert "Downloads: 1000" in results[0]["content"]assert "_raw" not in results[0]---class TestGutenbergIntegration:- """Integration tests making real API calls to Gutendex."""-- def test_real_search_sherlock_holmes(self):- """Test real search for Sherlock Holmes."""- from local_deep_research.web_search_engines.engines.search_engine_gutenberg import (- GutenbergSearchEngine,- )-- engine = GutenbergSearchEngine(max_results=5)- results = engine._get_previews("sherlock holmes")-- # Verify we got results- assert len(results) > 0, "Should find Sherlock Holmes books"-- # Verify result structure- for r in results:- assert "title" in r, "Each result should have a title"- assert "link" in r, "Each result should have a link"- assert r["source"] == "Project Gutenberg"- assert "gutenberg.org" in r["link"], "Link should be Gutenberg URL"-- # Verify at least one is actually Sherlock Holmes- titles = [r["title"].lower() for r in results]- assert any("sherlock" in t or "holmes" in t for t in titles), (- f"Should find Sherlock Holmes, got: {titles}"- )-- def test_real_search_finds_doyle(self):- """Test that Sherlock Holmes search finds Arthur Conan Doyle."""- from local_deep_research.web_search_engines.engines.search_engine_gutenberg import (- GutenbergSearchEngine,- )-- engine = GutenbergSearchEngine(max_results=5)- results = engine._get_previews("sherlock holmes doyle")-- assert len(results) > 0, "Should find results"-- # At least one should have Doyle as author- found_doyle = False- for r in results:- for author in r.get("authors", []):- if "doyle" in author.lower():- found_doyle = True- break- assert found_doyle, (- f"Should find Doyle as author, got: {[r.get('authors') for r in results]}"- )-- def test_real_search_pride_and_prejudice(self):- """Test real search for Pride and Prejudice."""- from local_deep_research.web_search_engines.engines.search_engine_gutenberg import (- GutenbergSearchEngine,- )-- engine = GutenbergSearchEngine(max_results=5)- results = engine._get_previews("pride and prejudice austen")-- assert len(results) > 0, "Should find Pride and Prejudice"-- # Check for Jane Austen- found_austen = False- for r in results:- for author in r.get("authors", []):- if "austen" in author.lower():- found_austen = True- break- assert found_austen, (- f"Should find Austen, got: {[r.get('authors') for r in results]}"- )-- def test_real_search_returns_download_count(self):- """Test that real search returns download counts."""- from local_deep_research.web_search_engines.engines.search_engine_gutenberg import (- GutenbergSearchEngine,- )-- engine = GutenbergSearchEngine(max_results=3)- results = engine._get_previews("moby dick")-- assert len(results) > 0, "Should find Moby Dick"-- # Popular books should have download counts- first = results[0]- assert "download_count" in first, "Should have download_count"- assert first["download_count"] > 0, "Popular book should have downloads"-- def test_real_search_with_language_filter(self):- """Test real search with English language filter."""- from local_deep_research.web_search_engines.engines.search_engine_gutenberg import (- GutenbergSearchEngine,- )-- engine = GutenbergSearchEngine(max_results=5, languages="en")- results = engine._get_previews("sherlock holmes")-- assert len(results) > 0, "Should find English Sherlock Holmes books"-- # All results should have English- for r in results:- assert "en" in r.get("languages", []), (- f"Should be English, got languages: {r.get('languages')}"- )-- def test_real_search_has_read_url(self):- """Test that results include read URLs."""- from local_deep_research.web_search_engines.engines.search_engine_gutenberg import (- GutenbergSearchEngine,- )-- engine = GutenbergSearchEngine(max_results=3)- results = engine._get_previews("frankenstein")-- assert len(results) > 0, "Should find Frankenstein"-- # At least one should have a read URL- has_read_url = any(r.get("read_url") for r in results)- assert has_read_url, "At least one result should have read_url"diff --git a/tests/search_engines/test_search_engine_openlibrary.py b/tests/search_engines/test_search_engine_openlibrary.pyindex 49a3e6e62e..69b2904acc 100644--- a/tests/search_engines/test_search_engine_openlibrary.py+++ b/tests/search_engines/test_search_engine_openlibrary.py@@ -560,115 +560,3 @@ class TestOpenLibraryHelperMethods:book = engine.get_book_by_isbn("invalid")assert book is None---class TestOpenLibraryIntegration:- """Integration tests making real API calls to Open Library."""-- def test_real_search_harry_potter(self):- """Test real search for Harry Potter books."""- from local_deep_research.web_search_engines.engines.search_engine_openlibrary import (- OpenLibrarySearchEngine,- )-- engine = OpenLibrarySearchEngine(max_results=5)- results = engine._get_previews("harry potter")-- # Verify we got results- assert len(results) > 0, "Should find Harry Potter books"-- # Verify result structure- for r in results:- assert "title" in r, "Each result should have a title"- assert "link" in r, "Each result should have a link"- assert r["source"] == "Open Library", (- "Source should be Open Library"- )- assert r["link"].startswith("https://openlibrary.org"), (- "Link should be valid"- )-- # Verify at least one result mentions Harry Potter- titles = [r["title"].lower() for r in results]- assert any("harry potter" in t or "potter" in t for t in titles), (- f"At least one result should contain 'Harry Potter', got: {titles}"- )-- def test_real_author_search_stephen_king(self):- """Test real author search for Stephen King."""- from local_deep_research.web_search_engines.engines.search_engine_openlibrary import (- OpenLibrarySearchEngine,- )-- engine = OpenLibrarySearchEngine(max_results=5, search_field="author")- results = engine._get_previews("Stephen King")-- # Verify we got results- assert len(results) > 0, "Should find Stephen King books"-- # Verify at least one result has Stephen King as author- found_king = False- for r in results:- authors = r.get("authors", [])- for author in authors:- if "king" in author.lower():- found_king = True- break- assert found_king, (- f"At least one result should have King as author, got: {[r.get('authors') for r in results]}"- )-- def test_real_title_search_1984(self):- """Test real title search for 1984."""- from local_deep_research.web_search_engines.engines.search_engine_openlibrary import (- OpenLibrarySearchEngine,- )-- engine = OpenLibrarySearchEngine(max_results=5, search_field="title")- results = engine._get_previews("1984")-- # Verify we got results- assert len(results) > 0, "Should find books with 1984 in title"-- # Verify result has expected fields- first = results[0]- assert "title" in first- assert "authors" in first- assert "link" in first-- def test_real_search_returns_metadata(self):- """Test that real search returns proper metadata."""- from local_deep_research.web_search_engines.engines.search_engine_openlibrary import (- OpenLibrarySearchEngine,- )-- engine = OpenLibrarySearchEngine(max_results=3)- results = engine._get_previews("lord of the rings tolkien")-- assert len(results) > 0, "Should find Lord of the Rings"-- # Check first result has expected metadata- first = results[0]- assert first.get("title"), "Should have title"- assert first.get("authors"), "Should have authors"- assert first.get("link"), "Should have link"- assert first.get("id"), "Should have id"-- # Verify it's actually Tolkien- authors = first.get("authors", [])- assert any("tolkien" in a.lower() for a in authors), (- f"Should find Tolkien as author, got: {authors}"- )-- def test_real_search_with_language_filter(self):- """Test real search with language filter."""- from local_deep_research.web_search_engines.engines.search_engine_openlibrary import (- OpenLibrarySearchEngine,- )-- engine = OpenLibrarySearchEngine(max_results=5, language="eng")- results = engine._get_previews("science fiction")-- assert len(results) > 0, "Should find science fiction books in English"- assert all(r["source"] == "Open Library" for r in results)diff --git a/tests/search_engines/test_search_engine_pubchem.py b/tests/search_engines/test_search_engine_pubchem.pyindex b12bf520da..2407187dd1 100644--- a/tests/search_engines/test_search_engine_pubchem.py+++ b/tests/search_engines/test_search_engine_pubchem.py@@ -324,131 +324,3 @@ class TestPubChemFullContent:assert "Molecular Formula: C9H8O4" in results[0]["content"]assert "Molecular Weight: 180.16 g/mol" in results[0]["content"]assert "_raw" not in results[0]---class TestPubChemIntegration:- """Integration tests making real API calls to PubChem."""-- def test_real_search_aspirin(self):- """Test real search for aspirin."""- from local_deep_research.web_search_engines.engines.search_engine_pubchem import (- PubChemSearchEngine,- )-- engine = PubChemSearchEngine(max_results=3)- results = engine._get_previews("aspirin")-- # Verify we got results- assert len(results) > 0, "Should find aspirin"-- # Verify first result- first = results[0]- assert "title" in first, "Should have title"- assert "link" in first, "Should have link"- assert first["source"] == "PubChem", "Source should be PubChem"- assert "pubchem.ncbi.nlm.nih.gov" in first["link"], (- "Link should be PubChem URL"- )-- def test_real_search_returns_molecular_formula(self):- """Test that real search returns molecular formula."""- from local_deep_research.web_search_engines.engines.search_engine_pubchem import (- PubChemSearchEngine,- )-- engine = PubChemSearchEngine(max_results=1)- results = engine._get_previews("caffeine")-- assert len(results) > 0, "Should find caffeine"-- first = results[0]- assert first.get("molecular_formula"), "Should have molecular_formula"- # Caffeine is C8H10N4O2- assert "C" in first["molecular_formula"], "Formula should contain C"-- def test_real_search_returns_molecular_weight(self):- """Test that real search returns molecular weight."""- from local_deep_research.web_search_engines.engines.search_engine_pubchem import (- PubChemSearchEngine,- )-- engine = PubChemSearchEngine(max_results=1)- results = engine._get_previews("glucose")-- assert len(results) > 0, "Should find glucose"-- first = results[0]- assert first.get("molecular_weight"), "Should have molecular_weight"- # Just verify molecular weight is a positive number- # (PubChem may return different glucose compounds like derivatives)- weight = float(first["molecular_weight"])- assert weight > 0, f"Molecular weight should be positive, got {weight}"-- def test_real_search_returns_smiles(self):- """Test that real search returns SMILES notation."""- from local_deep_research.web_search_engines.engines.search_engine_pubchem import (- PubChemSearchEngine,- )-- engine = PubChemSearchEngine(max_results=1)- results = engine._get_previews("ethanol")-- assert len(results) > 0, "Should find ethanol"-- first = results[0]- assert first.get("smiles"), "Should have SMILES"- # Ethanol SMILES should contain C and O- assert "C" in first["smiles"] and "O" in first["smiles"], (- f"Ethanol SMILES should contain C and O, got: {first['smiles']}"- )-- def test_real_search_returns_cid(self):- """Test that real search returns compound ID."""- from local_deep_research.web_search_engines.engines.search_engine_pubchem import (- PubChemSearchEngine,- )-- engine = PubChemSearchEngine(max_results=1)- results = engine._get_previews("water")-- assert len(results) > 0, "Should find water"-- first = results[0]- assert first.get("cid"), "Should have CID"- assert isinstance(first["cid"], int), "CID should be integer"-- def test_real_search_ibuprofen(self):- """Test real search for ibuprofen."""- from local_deep_research.web_search_engines.engines.search_engine_pubchem import (- PubChemSearchEngine,- )-- engine = PubChemSearchEngine(max_results=1)- results = engine._get_previews("ibuprofen")-- assert len(results) > 0, "Should find ibuprofen"-- first = results[0]- # Ibuprofen CID is 3672- assert first.get("cid"), "Should have CID"- assert first.get("iupac_name"), "Should have IUPAC name"-- def test_real_search_partial_name(self):- """Test real search with partial compound name."""- from local_deep_research.web_search_engines.engines.search_engine_pubchem import (- PubChemSearchEngine,- )-- engine = PubChemSearchEngine(max_results=5)- results = engine._get_previews("acet")-- # Should find compounds starting with "acet" like acetone, acetamide, etc.- assert len(results) > 0, "Should find compounds starting with 'acet'"-- # At least one should have a title starting with "acet"- titles = [r["title"].lower() for r in results]- has_acet = any("acet" in t for t in titles)- assert has_acet, (- f"Should find compound starting with 'acet', got: {titles}"- )diff --git a/tests/search_engines/test_search_engine_stackexchange.py b/tests/search_engines/test_search_engine_stackexchange.pyindex 332c58b48c..8533b923e0 100644--- a/tests/search_engines/test_search_engine_stackexchange.py+++ b/tests/search_engines/test_search_engine_stackexchange.py@@ -642,130 +642,3 @@ class TestStackExchangeEdgeCases:for input_text, expected in test_cases:result = engine._decode_html(input_text)assert result == expected, f"Failed for {input_text}"---class TestStackExchangeIntegration:- """Integration tests making real API calls to Stack Exchange."""-- def test_real_search_python(self):- """Test real search for Python questions."""- from local_deep_research.web_search_engines.engines.search_engine_stackexchange import (- StackExchangeSearchEngine,- )-- engine = StackExchangeSearchEngine(max_results=5)- results = engine._get_previews("python list comprehension")-- # Verify we got results- assert len(results) > 0, "Should find Python questions"-- # Verify result structure- for r in results:- assert "title" in r, "Each result should have a title"- assert "link" in r, "Each result should have a link"- assert r["source"] == "Stack Overflow", (- "Source should be Stack Overflow"- )- assert "stackoverflow.com" in r["link"], "Link should be SO URL"-- def test_real_search_returns_scores(self):- """Test that real search returns scores."""- from local_deep_research.web_search_engines.engines.search_engine_stackexchange import (- StackExchangeSearchEngine,- )-- engine = StackExchangeSearchEngine(max_results=5)- results = engine._get_previews("javascript async await")-- assert len(results) > 0, "Should find JavaScript questions"-- # All should have score- for r in results:- assert "score" in r, "Should have score"- assert isinstance(r["score"], int), "Score should be int"-- def test_real_search_returns_tags(self):- """Test that real search returns tags."""- from local_deep_research.web_search_engines.engines.search_engine_stackexchange import (- StackExchangeSearchEngine,- )-- engine = StackExchangeSearchEngine(max_results=5)- results = engine._get_previews("react hooks")-- assert len(results) > 0, "Should find React questions"-- # At least some should have tags- has_tags = any(r.get("tags") for r in results)- assert has_tags, (- f"At least one should have tags, got: {[r.get('tags') for r in results]}"- )-- def test_real_search_different_site(self):- """Test real search on different Stack Exchange site."""- from local_deep_research.web_search_engines.engines.search_engine_stackexchange import (- StackExchangeSearchEngine,- )-- engine = StackExchangeSearchEngine(max_results=5, site="unix")- results = engine._get_previews("bash script loop")-- assert len(results) > 0, "Should find Unix questions"-- # Source should reflect the site- assert results[0]["source"] == "Unix & Linux", (- f"Source should be Unix & Linux, got: {results[0]['source']}"- )- assert results[0]["site"] == "unix"-- def test_real_search_with_high_score(self):- """Test real search with minimum score filter."""- from local_deep_research.web_search_engines.engines.search_engine_stackexchange import (- StackExchangeSearchEngine,- )-- engine = StackExchangeSearchEngine(- max_results=5, min_score=100, sort="votes"- )- results = engine._get_previews("python")-- assert len(results) > 0, "Should find high-score Python questions"-- # All should have score >= 100- for r in results:- assert r["score"] >= 100, (- f"Score should be >= 100, got: {r['score']}"- )-- def test_real_search_returns_answer_count(self):- """Test that real search returns answer counts."""- from local_deep_research.web_search_engines.engines.search_engine_stackexchange import (- StackExchangeSearchEngine,- )-- engine = StackExchangeSearchEngine(max_results=5, has_answers=True)- results = engine._get_previews("docker container")-- assert len(results) > 0, "Should find Docker questions with answers"-- # All should have at least one answer- for r in results:- assert r["answer_count"] >= 1, (- f"Should have answers, got: {r['answer_count']}"- )-- def test_real_search_returns_author_info(self):- """Test that real search returns author information."""- from local_deep_research.web_search_engines.engines.search_engine_stackexchange import (- StackExchangeSearchEngine,- )-- engine = StackExchangeSearchEngine(max_results=5)- results = engine._get_previews("git merge conflict")-- assert len(results) > 0, "Should find Git questions"-- # At least some should have author- has_author = any(r.get("author") for r in results)- assert has_author, "At least one should have author"diff --git a/tests/search_engines/test_search_engine_zenodo.py b/tests/search_engines/test_search_engine_zenodo.pyindex 15b69d8b2e..e6836dcbd5 100644--- a/tests/search_engines/test_search_engine_zenodo.py+++ b/tests/search_engines/test_search_engine_zenodo.py@@ -561,123 +561,3 @@ class TestZenodoFullContent:assert "DOI: 10.5281/zenodo.12345" in results[0]["content"]assert "_raw" not in results[0]assert len(results[0]["files"]) == 1---class TestZenodoIntegration:- """Integration tests making real API calls to Zenodo.-- Note: These tests depend on external Zenodo API availability.- They handle empty results gracefully since API may be rate-limited in CI.- """-- def test_real_search_machine_learning(self):- """Test real search for machine learning datasets."""- from local_deep_research.web_search_engines.engines.search_engine_zenodo import (- ZenodoSearchEngine,- )-- engine = ZenodoSearchEngine(max_results=5)- results = engine._get_previews("machine learning")-- # API may be rate-limited; verify structure if results returned- if len(results) > 0:- for r in results:- assert "title" in r, "Each result should have a title"- assert "link" in r, "Each result should have a link"- assert r["source"] == "Zenodo", "Source should be Zenodo"- assert "zenodo.org" in r["link"], "Link should be Zenodo URL"-- def test_real_search_returns_doi(self):- """Test that real search returns DOIs."""- from local_deep_research.web_search_engines.engines.search_engine_zenodo import (- ZenodoSearchEngine,- )-- engine = ZenodoSearchEngine(max_results=5)- results = engine._get_previews("climate data")-- # API may be rate-limited; verify DOI if results returned- if len(results) > 0:- has_doi = any(r.get("doi") for r in results)- assert has_doi, "At least one result should have a DOI"-- def test_real_search_datasets(self):- """Test real search filtered to datasets."""- from local_deep_research.web_search_engines.engines.search_engine_zenodo import (- ZenodoSearchEngine,- )-- engine = ZenodoSearchEngine(max_results=5, resource_type="dataset")- results = engine._get_previews("genomics")-- # API may be rate-limited; verify type if results returned- if len(results) > 0:- for r in results:- assert r.get("resource_type") in [- "Dataset",- "dataset",- "Other",- ], f"Should be dataset type, got: {r.get('resource_type')}"-- def test_real_search_software(self):- """Test real search filtered to software."""- from local_deep_research.web_search_engines.engines.search_engine_zenodo import (- ZenodoSearchEngine,- )-- engine = ZenodoSearchEngine(max_results=5, resource_type="software")- results = engine._get_previews("python")-- # API may be rate-limited; verify links if results returned- if len(results) > 0:- for r in results:- assert r["link"].startswith("https://zenodo.org"), (- f"Link should be Zenodo URL: {r['link']}"- )-- def test_real_search_returns_authors(self):- """Test that real search returns authors."""- from local_deep_research.web_search_engines.engines.search_engine_zenodo import (- ZenodoSearchEngine,- )-- engine = ZenodoSearchEngine(max_results=5)- results = engine._get_previews("neural network")-- # API may be rate-limited; verify authors if results returned- if len(results) > 0:- has_authors = any(r.get("authors") for r in results)- assert has_authors, (- f"At least one should have authors, got: {[r.get('authors') for r in results]}"- )-- def test_real_search_open_access(self):- """Test real search for open access records."""- from local_deep_research.web_search_engines.engines.search_engine_zenodo import (- ZenodoSearchEngine,- )-- engine = ZenodoSearchEngine(max_results=5, access_right="open")- results = engine._get_previews("biology")-- # API may be rate-limited; verify access_right if results returned- if len(results) > 0:- for r in results:- assert r.get("access_right") == "open", (- f"Should be open access, got: {r.get('access_right')}"- )-- def test_real_search_returns_publication_date(self):- """Test that real search returns publication dates."""- from local_deep_research.web_search_engines.engines.search_engine_zenodo import (- ZenodoSearchEngine,- )-- engine = ZenodoSearchEngine(max_results=5)- results = engine._get_previews("astronomy")-- # API may be rate-limited; verify publication_date if results returned- if len(results) > 0:- has_date = any(r.get("publication_date") for r in results)- assert has_date, "At least one should have publication_date"