~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: remove 7 no-assertion / placeholder tests across 7 files (#4247)
LearningCircuita385258c99e1
diff --git a/tests/api_tests/test_api_pytest.py b/tests/api_tests/test_api_pytest.pyindex 69843cb342..874da869d3 100644--- a/tests/api_tests/test_api_pytest.py+++ b/tests/api_tests/test_api_pytest.py@@ -103,18 +103,6 @@ class TestRestAPIBasic:or "required" in error_msg)- def test_cors_headers(self, authenticated_client):- """Test that CORS headers are properly set."""- response = authenticated_client.get("/api/v1/health")- assert response.status_code == 200-- # Check for CORS headers if they are configured- # This may be optional depending on the app configuration- # Common CORS headers to check:- # - Access-Control-Allow-Origin- # - Access-Control-Allow-Methods- # - Access-Control-Allow-Headers-def test_error_response_format(self, authenticated_client):"""Test that error responses follow consistent format."""# Trigger a 404 error@@ -124,14 +112,3 @@ class TestRestAPIBasic:if response.content_type == "application/json":data = json.loads(response.data)assert "error" in data or "message" in data-- def test_rate_limiting_headers(self, authenticated_client):- """Test that rate limiting headers are present if configured."""- response = authenticated_client.get("/api/v1/health")- assert response.status_code == 200-- # Check for rate limiting headers if configured- # Common headers:- # - X-RateLimit-Limit- # - X-RateLimit-Remaining- # - X-RateLimit-Resetdiff --git a/tests/api_tests/test_rest_api.py b/tests/api_tests/test_rest_api.pyindex 794ebac4f6..914ca72e80 100644--- a/tests/api_tests/test_rest_api.py+++ b/tests/api_tests/test_rest_api.py@@ -206,12 +206,3 @@ class TestRestAPI:assert response.status_code in [400, 500]print("✅ Error handling passed")-- def test_cors_headers(self, client):- """Test CORS headers on API endpoints."""- response = client.get("/api/v1/health")- assert response.status_code == 200-- # CORS headers might be conditionally set- # Just verify the endpoint works- print("✅ CORS test passed")diff --git a/tests/test_api_settings_advanced.py b/tests/test_api_settings_advanced.pyindex 2533c5e5e7..96b4af4833 100644--- a/tests/test_api_settings_advanced.py+++ b/tests/test_api_settings_advanced.py@@ -1,7 +1,6 @@"""Advanced tests for programmatic API settings functionality."""import threading-from unittest.mock import patch, MagicMockfrom local_deep_research.api.settings_utils import (InMemorySettingsManager,@@ -263,24 +262,6 @@ class TestSettingsIntegration:assert extract_setting_value(complex_snapshot, "list") == [1, 2, 3]assert extract_setting_value(complex_snapshot, "null") is None- @patch("local_deep_research.database.session_context.get_user_db_session")- def test_web_api_still_uses_database(self, mock_get_db):- """Test that web API endpoints still use database for settings."""- # This test would verify that the web API doesn't use InMemorySettingsManager- # but continues to use the database-backed settings-- # Mock database session- mock_session = MagicMock()- mock_get_db.return_value = mock_session-- # Import web routes (this would normally trigger database usage)- # Note: This is a conceptual test - actual implementation would depend on- # how the web routes are structured-- # Verify database session was used (not InMemorySettingsManager)- # This ensures separation between programmatic and web APIs- pass # Placeholder for actual web API testing-class TestComplexSettingsScenarios:"""Test complex real-world settings scenarios."""diff --git a/tests/test_api_settings_e2e.py b/tests/test_api_settings_e2e.pyindex a0de381431..b671bbab18 100644--- a/tests/test_api_settings_e2e.py+++ b/tests/test_api_settings_e2e.py@@ -160,39 +160,6 @@ class TestE2EResearchWithSettings:class TestMultiProviderScenarios:"""Test scenarios with multiple LLM providers."""- @patch("local_deep_research.config.llm_config.get_llm")- def test_provider_fallback_scenario(self, mock_get_llm):- """Test fallback between providers based on settings."""- # Simulate primary provider failure- primary_llm = MagicMock()- primary_llm.invoke.side_effect = Exception("API rate limit exceeded")-- # Simulate fallback provider success- fallback_llm = MagicMock()- fallback_llm.invoke.return_value = MagicMock(- content="Fallback response"- )-- # Configure mock to return different LLMs based on provider- def get_llm_side_effect(*args, **kwargs):- snapshot = kwargs.get("settings_snapshot", {})- provider = snapshot.get("llm.provider", {}).get("value", "")- if provider == "openai":- return primary_llm- return fallback_llm-- mock_get_llm.side_effect = get_llm_side_effect-- # This test demonstrates how settings could enable provider fallback- # (actual implementation would need fallback logic)- _ = create_settings_snapshot(- provider="openai",- overrides={- "llm.fallback_provider": "anthropic",- "llm.anthropic.api_key": "fallback-key",- },- )-def test_multi_model_research(self):"""Test research using multiple models for comparison."""models = [diff --git a/tests/test_context_overflow_detection.py b/tests/test_context_overflow_detection.pyindex dd5575d99b..a35532b68b 100644--- a/tests/test_context_overflow_detection.py+++ b/tests/test_context_overflow_detection.py@@ -8,7 +8,7 @@ import pytestfrom sqlalchemy import create_enginefrom sqlalchemy.orm import sessionmaker-from local_deep_research.database.models import Base, TokenUsage+from local_deep_research.database.models import Basefrom local_deep_research.metrics.token_counter import TokenCountingCallback@@ -492,63 +492,6 @@ class TestContextOverflowDetection:token_callback.on_llm_end(mock_response)assert token_callback.context_truncated is False- def test_token_usage_save_with_overflow_fields(- self, db_session, monkeypatch- ):- """Test that overflow fields are saved to database."""- # Skip this test as it requires Flask context- pytest.skip("Requires Flask application context")-- # Mock get_user_db_session to return our test session- def mock_get_session(username):- class SessionContext:- def __enter__(self):- return db_session-- def __exit__(self, *args):- pass-- return SessionContext()-- monkeypatch.setattr(- "local_deep_research.metrics.token_counter.get_user_db_session",- mock_get_session,- )-- # Create callback and simulate overflow- research_id = str(uuid.uuid4())- callback = TokenCountingCallback(research_id, {"context_limit": 2048})-- # Simulate overflow scenario- callback.current_model = "test-model"- callback.current_provider = "ollama"- callback.context_truncated = True- callback.tokens_truncated = 500- callback.truncation_ratio = 0.2- callback.ollama_metrics = {- "prompt_eval_count": 2000,- "eval_count": 100,- "total_duration": 5000000000,- }-- # Save to database- callback._save_to_db(2000, 100)-- # Verify saved data- saved = (- db_session.query(TokenUsage)- .filter_by(research_id=research_id)- .first()- )- assert saved is not None- assert saved.context_limit == 2048- assert saved.context_truncated == 1- assert saved.tokens_truncated == 500- assert saved.truncation_ratio == 0.2- assert saved.ollama_prompt_eval_count == 2000- assert saved.ollama_eval_count == 100- assert saved.ollama_total_duration == 5000000000-@pytest.mark.skipif(os.environ.get("SKIP_OLLAMA_TESTS", "true").lower() == "true",diff --git a/tests/test_link_analytics.py b/tests/test_link_analytics.pyindex aefbe97372..d156750e51 100644--- a/tests/test_link_analytics.py+++ b/tests/test_link_analytics.py@@ -238,98 +238,6 @@ class TestLinkAnalytics:assert "top_domains" in analyticsassert isinstance(analytics["top_domains"], list)- def test_get_link_analytics_source_categorization(self):- """Test correct categorization of sources."""- resources = [- MagicMock(- url="https://arxiv.org/paper1",- research_id="1",- source_type=None,- title="Paper 1",- content_preview=None,- created_at="2024-01-01T00:00:00Z",- ),- MagicMock(- url="https://scholar.google.com/paper2",- research_id="1",- source_type=None,- title="Paper 2",- content_preview=None,- created_at="2024-01-01T00:00:00Z",- ),- MagicMock(- url="https://university.edu/research",- research_id="1",- source_type=None,- title="Research",- content_preview=None,- created_at="2024-01-01T00:00:00Z",- ),- MagicMock(- url="https://cnn.com/news",- research_id="1",- source_type=None,- title="News",- content_preview=None,- created_at="2024-01-01T00:00:00Z",- ),- MagicMock(- url="https://bbc.co.uk/article",- research_id="1",- source_type=None,- title="Article",- content_preview=None,- created_at="2024-01-01T00:00:00Z",- ),- MagicMock(- url="https://wikipedia.org/topic",- research_id="1",- source_type=None,- title="Topic",- content_preview=None,- created_at="2024-01-01T00:00:00Z",- ),- MagicMock(- url="https://docs.python.org/3/",- research_id="1",- source_type=None,- title="Python Docs",- content_preview=None,- created_at="2024-01-01T00:00:00Z",- ),- MagicMock(- url="https://example.com/page",- research_id="1",- source_type=None,- title="Example",- content_preview=None,- created_at="2024-01-01T00:00:00Z",- ),- ]-- with patch(- "local_deep_research.web.routes.metrics_routes.get_user_db_session"- ) as mock_session:- mock_db = MagicMock()- mock_db.query.return_value.all.return_value = resources- mock_session.return_value.__enter__.return_value = mock_db-- # Mock DomainClassifier- with patch(- "local_deep_research.web.routes.metrics_routes.DomainClassifier"- ) as mock_classifier:- mock_classifier_instance = MagicMock()- mock_classifier_instance.get_classification.return_value = (- MagicMock(category="Academic")- )- mock_classifier.return_value = mock_classifier_instance-- # Just call the function to verify it doesn't error- get_link_analytics(username="test_user")-- # The actual categorization is done by DomainClassifier which uses LLM- # So we can't assert exact counts without mocking the classifier-# Removed TestLinkAnalyticsAPI class - these tests have request context issues# and are testing Flask routing which is already covered by integration testsdiff --git a/tests/web/routes/test_context_overflow_api.py b/tests/web/routes/test_context_overflow_api.pyindex 914ec05172..d4370290f2 100644--- a/tests/web/routes/test_context_overflow_api.py+++ b/tests/web/routes/test_context_overflow_api.py@@ -9,30 +9,13 @@ Tests cover:"""import pytest-from unittest.mock import Mock, patch+from unittest.mock import Mockfrom datetime import datetime, timezoneclass TestGetContextOverflowMetricsUnit:"""Unit tests for get_context_overflow_metrics logic."""- def test_get_metrics_no_username(self):- """Test returns 401 when no username in session."""- from flask import Flask-- app = Flask(__name__)- app.secret_key = "test"-- with app.test_request_context():- # Mock login_required to pass through- with patch(- "local_deep_research.web.auth.decorators.login_required",- lambda f: f,- ):- # The function expects flask_session.get("username") to return something- # When it returns None, should return 401- pass-def test_calculate_truncation_rate(self):"""Test truncation rate calculation."""# Test the calculation logic