~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
"""
Shared fixtures for notification tests.
Notifications are gated behind LDR_NOTIFICATIONS_ALLOW_OUTBOUND at the server level
(see SECURITY.md "Notification Webhook SSRF"). Existing tests exercise the
underlying logic and assume the gate is open; this autouse fixture sets the
env var so they don't all need explicit monkeypatching. Tests that want to
verify the gate behavior itself can override by calling
``monkeypatch.delenv("LDR_NOTIFICATIONS_ALLOW_OUTBOUND", raising=False)`` inside
the test body.
"""
from io import StringIO
import pytest
from loguru import logger as loguru_logger
@pytest.fixture(autouse=True)
def enable_notifications_by_default(monkeypatch):
monkeypatch.setenv("LDR_NOTIFICATIONS_ALLOW_OUTBOUND", "true")
@pytest.fixture
def capture_loguru():
"""Capture loguru output INCLUDING the bound ``extra`` mapping.
Credential-leak assertions must see the structured fields too: a
``logger.bind(...).warning("msg", field=value)`` call puts ``field``
in ``record["extra"]``, not in ``{message}``, so a ``{message}``-only
sink would make a leak-through-``extra`` test pass vacuously.
"""
output = StringIO()
sink_id = loguru_logger.add(
output,
format="{message} | {extra}",
level="DEBUG",
diagnose=False,
)
loguru_logger.enable("local_deep_research")
try:
yield output
finally:
loguru_logger.remove(sink_id)
# Restore the package's default-disabled state (see
# ``src/local_deep_research/__init__.py`` and the ``loguru_caplog``
# fixtures in the root conftest, which do the same).
loguru_logger.disable("local_deep_research")
@pytest.fixture
def capture_loguru_records():
"""Capture raw loguru records, so a test can assert on
``record["message"]`` alone.
``record["message"]`` is the only field the production sinks show an
operator: the stderr/file formats carry no ``{extra}``, and the
database sink persists only the message. A diagnostic passed as a
loguru kwarg without a template placeholder lands in ``extra`` and is
never displayed (#5619) — ``capture_loguru``'s
``"{message} | {extra}"`` format would let such a test pass anyway.
"""
records = []
sink_id = loguru_logger.add(
lambda message: records.append(message.record),
level="DEBUG",
diagnose=False,
)
loguru_logger.enable("local_deep_research")
try:
yield records
finally:
loguru_logger.remove(sink_id)
loguru_logger.disable("local_deep_research")