~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
chore(tests): pin diagnose=False on test-fixture loguru sinks (#4185) (#4404)
LearningCircuitfb85e4080000
diff --git a/changelog.d/+test-fixtures-loguru-diagnose-off.misc.md b/changelog.d/+test-fixtures-loguru-diagnose-off.misc.mdnew file mode 100644index 0000000000..ad39fc7b47--- /dev/null+++ b/changelog.d/+test-fixtures-loguru-diagnose-off.misc.md@@ -0,0 +1 @@+Test fixtures and dev scripts that re-configure loguru (``tests/conftest.py`` loguru-caplog fixture, the two ``tests/api_tests/`` ``__main__`` runners, ``tests/test_openai_api_key_e2e.py``, ``tests/settings/test_manager_behavior.py``, ``tests/journal_quality/test_db.py``, ``tests/performance/mcp/echo_server.py``) now pass ``diagnose=False`` to their ``logger.add(...)`` calls, matching the production policy locked in by #4384 / #4394. loguru defaults ``diagnose=True``, which renders ``repr()`` of every traceback frame's local on exception; pinning it off keeps frame-local credentials (api keys, SQLCipher passwords, ``Authorization`` headers) out of pytest output and CI logs even when a test crashes mid-fixture. Hygiene change only — no behavior change for green tests.diff --git a/tests/api_tests/migrate_research_mode.py b/tests/api_tests/migrate_research_mode.pyindex 39a4c03b75..ab9fad12ef 100644--- a/tests/api_tests/migrate_research_mode.py+++ b/tests/api_tests/migrate_research_mode.py@@ -100,7 +100,10 @@ def migrate_all_user_databases():if __name__ == "__main__":# Enable debug logginglogger.remove()- logger.add(sys.stdout, level="INFO")+ # diagnose=False: don't dump frame-local credentials in tracebacks+ # (#4185 / #4384). This script touches user databases and SQLCipher+ # passwords live in frame locals during migration.+ logger.add(sys.stdout, level="INFO", diagnose=False)# Allow unencrypted for testingos.environ["LDR_BOOTSTRAP_ALLOW_UNENCRYPTED"] = "true"diff --git a/tests/api_tests/run_basic_api_tests.py b/tests/api_tests/run_basic_api_tests.pyindex f86f5d7fba..ddd8894baf 100644--- a/tests/api_tests/run_basic_api_tests.py+++ b/tests/api_tests/run_basic_api_tests.py@@ -40,10 +40,13 @@ def run_working_tests():if __name__ == "__main__":# Setup logginglogger.remove()+ # diagnose=False: don't dump frame-local credentials in tracebacks+ # (#4185 / #4384). API tests hold api_key and password locals.logger.add(sys.stdout,level="INFO",format="<green>{time:HH:mm:ss}</green> | <level>{level: <8}</level> | <level>{message}</level>",+ diagnose=False,)success = run_working_tests()diff --git a/tests/conftest.py b/tests/conftest.pyindex 755935464d..636468bd09 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -654,6 +654,11 @@ def loguru_caplog(caplog):PropagateHandler(),format="{message}",level="DEBUG",+ # diagnose=False: loguru defaults to True, which dumps repr() of+ # every traceback frame's local on exception. The propagating handler+ # forwards those into pytest's stdlib log capture, where they end up+ # in CI logs. Hygiene companion to #4185 / #4384.+ diagnose=False,)yield caploglogger.remove(handler_id)diff --git a/tests/journal_quality/test_db.py b/tests/journal_quality/test_db.pyindex 33f07519df..a3812b239b 100644--- a/tests/journal_quality/test_db.py+++ b/tests/journal_quality/test_db.py@@ -714,7 +714,11 @@ class TestStaleDataVersionWarning:def _sink(message):records.append(message.record)- handler_id = loguru_logger.add(_sink, level="WARNING")+ # diagnose=False keeps the captured sink consistent with the+ # production policy (#4185 / #4384) — exceptions logged through this+ # fixture would otherwise carry frame-local repr() into recorded+ # messages and pytest output.+ handler_id = loguru_logger.add(_sink, level="WARNING", diagnose=False)loguru_logger.enable("local_deep_research")yield recordsloguru_logger.disable("local_deep_research")diff --git a/tests/performance/mcp/echo_server.py b/tests/performance/mcp/echo_server.pyindex 64538bb9f4..3d34772ac8 100644--- a/tests/performance/mcp/echo_server.py+++ b/tests/performance/mcp/echo_server.py@@ -13,10 +13,14 @@ from loguru import logger# Configure loguru to output to stderr to avoid stdout pollution# (MCP uses stdout for JSON-RPC communication)logger.remove() # Remove default handler+# diagnose=False mirrors the production MCP server (#4394) — loguru's+# default would dump repr() of every traceback frame's locals on exception,+# which we do not want even for the test echo server.logger.add(sys.stderr,level="INFO",format="{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | {message}",+ diagnose=False,)diff --git a/tests/settings/test_manager_behavior.py b/tests/settings/test_manager_behavior.pyindex 878e1d699d..795c8f3ceb 100644--- a/tests/settings/test_manager_behavior.py+++ b/tests/settings/test_manager_behavior.py@@ -396,7 +396,13 @@ class TestCheckEnvSetting:warnings = []logger.enable("local_deep_research")sink_id = logger.add(- lambda msg: warnings.append(str(msg)), level="WARNING"+ lambda msg: warnings.append(str(msg)),+ level="WARNING",+ # diagnose=False keeps the captured sink consistent with the+ # production policy (#4185 / #4384) — exceptions logged through+ # this fixture would otherwise carry frame-local repr() into+ # the captured list and into pytest output.+ diagnose=False,)try:with patch.dict(os.environ, {"LDR_LLM_PROVIDER": ""}):diff --git a/tests/test_openai_api_key_e2e.py b/tests/test_openai_api_key_e2e.pyindex 48b6823475..04553e98c4 100755--- a/tests/test_openai_api_key_e2e.py+++ b/tests/test_openai_api_key_e2e.py@@ -243,7 +243,11 @@ Note: The LDR server must be running and you must have a user account created.# Configure loggingif not args.verbose:logger.remove() # Remove default handler- logger.add(sys.stderr, level="ERROR") # Only show errors+ # diagnose=False: this e2e harness passes args.api_key and+ # args.password into the test function — both end up as frame locals+ # that loguru's default diagnose=True would dump into error tracebacks+ # (#4185 / #4384).+ logger.add(sys.stderr, level="ERROR", diagnose=False)# Run the testsuccess = test_openai_api_key_e2e(