~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
Update test to not return anything. (#453)
Daniel Pettia93ffd7f718b
diff --git a/tests/api_tests/test_api_basic.py b/tests/api_tests/test_api_basic.pyindex 1bf04f7010..76c78e9547 100644--- a/tests/api_tests/test_api_basic.py+++ b/tests/api_tests/test_api_basic.py@@ -3,9 +3,8 @@ Basic API tests - only test endpoints that should respond quickly.Focus on verifying the API is working without doing actual research."""-import time-import requests+import pytestBASE_URL = "http://localhost:5000/api/v1"@@ -18,7 +17,6 @@ def test_health_check():assert data["status"] == "ok"assert "timestamp" in dataprint("✅ Health check: API is responding")- return Truedef test_api_documentation():@@ -30,7 +28,6 @@ def test_api_documentation():assert "endpoints" in dataassert len(data["endpoints"]) >= 3print("✅ API documentation: All endpoints documented")- return Truedef test_error_handling():@@ -52,8 +49,6 @@ def test_error_handling():assert "error" in dataprint("✅ Error handling: Proper validation for missing collection_name")- return True-def test_api_structure():"""Test that API accepts properly formatted requests (without waiting for results)."""@@ -74,77 +69,25 @@ def test_api_structure():print("✅ API structure: Request format accepted by quick_summary endpoint")- return True+ returnexcept requests.exceptions.Timeout:# Timeout is expected - the API accepted the request but research takes timeprint("✅ API structure: Request format accepted (timed out during processing, which is expected)")- return True+ returnexcept requests.exceptions.ConnectionError as e:print(f"❌ API structure: Connection error - {e}")- return False+ pytest.fail("API connection error")+ returnexcept Exception as e:if "400" in str(e) or "Bad Request" in str(e):print(f"❌ API structure: Request format rejected - {e}")- return False+ pytest.fail("API structure: Request format rejected")+ returnelse:# Other errors during processing are acceptableprint("✅ API structure: Request format accepted (processing error, which is normal)")- return True---def run_basic_tests():- """Run basic API tests that should complete quickly."""- print("🚀 Starting Basic REST API Tests")- print("=" * 50)- print("Testing API endpoints and structure without full research...")-- tests = [- ("Health Check", test_health_check),- ("API Documentation", test_api_documentation),- ("Error Handling", test_error_handling),- ("API Structure", test_api_structure),- ]-- passed = 0- failed = 0-- for test_name, test_func in tests:- try:- print(f"\n🔍 {test_name}")- start_time = time.time()- result = test_func()- duration = time.time() - start_time-- if result:- passed += 1- print(f" ✅ PASSED in {duration:.2f}s")- else:- failed += 1- print(" ❌ FAILED")-- except Exception as e:- failed += 1- print(f" ❌ FAILED with error: {str(e)}")-- print("\n" + "=" * 50)- print(f"📊 Results: {passed}/{len(tests)} tests passed")-- if passed == len(tests):- print("🎉 ALL BASIC TESTS PASSED!")- print("✅ REST API endpoints are working correctly")- print("✅ Programmatic access integration is functional")- return True- else:- print(f"💥 {failed} tests failed")- return False---if __name__ == "__main__":- success = run_basic_tests()- if success:- print("\n🏁 API testing complete - REST API is operational!")- exit(0 if success else 1)+ returndiff --git a/tests/api_tests/test_rest_api.py b/tests/api_tests/test_rest_api.pyindex 6cd9936a37..c6f4c44ea7 100644--- a/tests/api_tests/test_rest_api.py+++ b/tests/api_tests/test_rest_api.py@@ -3,8 +3,6 @@ Test suite for REST API endpoints using minimal queries.Tests programmatic access functionality with fast, simple requests."""-import time-import pytestimport requests@@ -27,7 +25,6 @@ class TestRestAPI:assert data["status"] == "ok"assert "timestamp" in dataprint("✅ Health check passed")- return Truedef test_api_documentation(self):"""Test the API documentation endpoint."""@@ -39,7 +36,6 @@ class TestRestAPI:assert "endpoints" in dataassert len(data["endpoints"]) >= 3 # Should have at least 3 endpointsprint("✅ API documentation passed")- return True@pytest.mark.requires_llmdef test_quick_summary_minimal(self):@@ -69,7 +65,6 @@ class TestRestAPI:print(f"✅ Quick summary passed - got {len(data['summary'])} chars of summary")- return True@pytest.mark.requires_llmdef test_quick_summary_test_endpoint(self):@@ -93,7 +88,6 @@ class TestRestAPI:print(f"✅ Quick summary test passed - got {len(data['summary'])} chars of summary")- return Truedef test_error_handling_missing_query(self):"""Test error handling when query is missing."""@@ -109,7 +103,6 @@ class TestRestAPI:assert "required" in data["error"].lower()print("✅ Error handling passed")- return True@pytest.mark.requires_llmdef test_analyze_documents_error(self):@@ -128,57 +121,3 @@ class TestRestAPI:assert isinstance(data, dict)print("✅ Analyze documents error handling passed")- return True---def run_all_tests():- """Run all API tests and return True if all pass."""- test_instance = TestRestAPI()-- tests = [- ("Health Check", test_instance.test_health_check),- ("API Documentation", test_instance.test_api_documentation),- ("Quick Summary Minimal", test_instance.test_quick_summary_minimal),- ("Quick Summary Test", test_instance.test_quick_summary_test_endpoint),- ("Error Handling", test_instance.test_error_handling_missing_query),- ("Analyze Documents Error", test_instance.test_analyze_documents_error),- ]-- print("🚀 Starting REST API tests...")- print("=" * 50)-- passed = 0- failed = 0-- for test_name, test_func in tests:- try:- print(f"\n🔍 Running: {test_name}")- start_time = time.time()- result = test_func()- duration = time.time() - start_time-- if result:- passed += 1- print(f"✅ {test_name} passed in {duration:.2f}s")- else:- failed += 1- print(f"❌ {test_name} failed")-- except Exception as e:- failed += 1- print(f"❌ {test_name} failed with error: {str(e)}")-- print("\n" + "=" * 50)- print(f"📊 Test Results: {passed} passed, {failed} failed")-- if failed == 0:- print("🎉 All API tests passed!")- return True- else:- print("💥 Some tests failed")- return False---if __name__ == "__main__":- success = run_all_tests()- exit(0 if success else 1)diff --git a/tests/api_tests/test_rest_api_simple.py b/tests/api_tests/test_rest_api_simple.pyindex f08a9cd53f..d02b40d874 100644--- a/tests/api_tests/test_rest_api_simple.py+++ b/tests/api_tests/test_rest_api_simple.py@@ -3,8 +3,6 @@ Simple REST API tests with ultra-minimal queries and longer timeouts.Focus on basic functionality verification."""-import time-import pytestimport requests@@ -34,8 +32,6 @@ def test_health_and_docs():assert "endpoints" in dataprint("✅ API documentation passed")- return True-def test_error_handling():"""Test error handling for malformed requests."""@@ -57,8 +53,6 @@ def test_error_handling():assert "error" in dataprint("✅ Error handling for missing collection_name passed")- return True-@pytest.mark.requires_llmdef test_quick_summary_ultra_minimal():@@ -96,18 +90,15 @@ def test_quick_summary_ultra_minimal():f"✅ Quick summary passed - got {len(data['summary'])} chars of summary")print(f" Found {len(data['findings'])} findings")- return Trueelse:- print(f"❌ Quick summary failed with status {response.status_code}")+ pytest.fail(+ f"Quick summary failed with status {response.status_code}"+ )print(f" Response: {response.text[:200]}")- return False-except requests.exceptions.Timeout:- print(f"❌ Quick summary timed out after {RESEARCH_TIMEOUT}s")- return False+ pytest.fail(f"Quick summary timed out after {RESEARCH_TIMEOUT}s")except Exception as e:- print(f"❌ Quick summary failed with error: {str(e)}")- return False+ pytest.fail(f"Quick summary failed with error: {str(e)}")@pytest.mark.requires_llm@@ -137,67 +128,12 @@ def test_quick_summary_test_minimal():print(f"✅ Quick summary test passed - got {len(data['summary'])} chars of summary")- return Trueelse:- print(- f"❌ Quick summary test failed with status {response.status_code}"+ pytest.fail(+ f"Quick summary test failed with status {response.status_code}")print(f" Response: {response.text[:200]}")- return False-except requests.exceptions.Timeout:- print(f"❌ Quick summary test timed out after {RESEARCH_TIMEOUT}s")- return False+ pytest.fail(f"Quick summary test timed out after {RESEARCH_TIMEOUT}s")except Exception as e:- print(f"❌ Quick summary test failed with error: {str(e)}")- return False---def run_simple_tests():- """Run simplified API tests focusing on basic functionality."""- print("🚀 Starting Simple REST API tests...")- print("=" * 60)-- tests = [- ("Health and Documentation", test_health_and_docs),- ("Error Handling", test_error_handling),- ("Quick Summary Ultra-Minimal", test_quick_summary_ultra_minimal),- ("Quick Summary Test Minimal", test_quick_summary_test_minimal),- ]-- passed = 0- failed = 0-- for test_name, test_func in tests:- try:- print(f"\n📋 {test_name}")- print("-" * 40)- start_time = time.time()- result = test_func()- duration = time.time() - start_time-- if result:- passed += 1- print(f"✅ {test_name} PASSED in {duration:.2f}s")- else:- failed += 1- print(f"❌ {test_name} FAILED")-- except Exception as e:- failed += 1- print(f"❌ {test_name} FAILED with error: {str(e)}")-- print("\n" + "=" * 60)- print(f"📊 Final Results: {passed} passed, {failed} failed")-- if failed == 0:- print("🎉 ALL TESTS PASSED! REST API is working correctly.")- return True- else:- print(f"💥 {failed} tests failed, but {passed} basic tests passed")- return passed > 0 # Return True if at least some tests passed---if __name__ == "__main__":- success = run_simple_tests()- exit(0 if success else 1)+ pytest.fail(f"Quick summary test failed with error: {str(e)}")diff --git a/tests/feature_tests/test_custom_context.py b/tests/feature_tests/test_custom_context.pyindex 5efee7f367..4895eb4216 100644--- a/tests/feature_tests/test_custom_context.py+++ b/tests/feature_tests/test_custom_context.py@@ -134,10 +134,10 @@ def test_custom_context_size():# Show summarylogger.info("\n\n=== TEST RESULTS ===")for provider, result in results.items():+ test_succeeded = "error" not in resultstatus = "✓" if "error" not in result else "✗"logger.info(f"{status} {provider}: {result}")-- return results+ assert test_succeededif __name__ == "__main__":