Skip to content

~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.

fix: Add LDR_TESTING_WITH_MOCKS to CI Docker commands

LearningCircuit45d46ae4f570
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index e263048d60..f3610c8531 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -34,6 +34,7 @@ jobs:
docker run --rm \
-v $PWD:/app \
-e LDR_USE_FALLBACK_LLM=true \
+ -e LDR_TESTING_WITH_MOCKS=true \
-w /app \
ldr-test \
sh -c "python -m pytest -v \
@@ -103,6 +104,7 @@ jobs:
docker run --rm \
-v $PWD:/app \
-e LDR_USE_FALLBACK_LLM=true \
+ -e LDR_TESTING_WITH_MOCKS=true \
-w /app \
ldr-test \
sh -c "cd tests && python run_all_tests.py ci --no-server-start"
@@ -174,6 +176,7 @@ jobs:
docker run --rm \
-v $PWD:/app \
-e LDR_USE_FALLBACK_LLM=true \
+ -e LDR_TESTING_WITH_MOCKS=true \
-e CI=true \
--network host \
-w /app \
diff --git a/src/local_deep_research/config/llm_config.py b/src/local_deep_research/config/llm_config.py
index 743357edd3..962f2d2826 100644
--- a/src/local_deep_research/config/llm_config.py
+++ b/src/local_deep_research/config/llm_config.py
@@ -308,17 +308,8 @@ def get_llm(
# Check if we're in testing mode and should use fallback (but only when no API keys are configured)
# Skip fallback check if we're in test mode with mocks
- # Also skip if ChatOpenAI or ChatAnthropic are mocked (detected by checking if they're MagicMock)
- from unittest.mock import MagicMock
-
- is_mocked = isinstance(ChatOpenAI, MagicMock) or isinstance(
- ChatAnthropic, MagicMock
- )
-
- if (
- os.environ.get("LDR_USE_FALLBACK_LLM", "")
- and not os.environ.get("LDR_TESTING_WITH_MOCKS", "")
- and not is_mocked
+ if os.environ.get("LDR_USE_FALLBACK_LLM", "") and not os.environ.get(
+ "LDR_TESTING_WITH_MOCKS", ""
):
# Only use fallback if the provider has no valid configuration
provider_has_config = False
diff --git a/tests/conftest.py b/tests/conftest.py
index ce01a08868..624cc4ff4a 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -49,9 +49,10 @@ def pytest_configure(config):
"requires_llm: mark test as requiring a real LLM (not fallback)",
)
- # Set environment variable to indicate we're in test mode with mocks
- # This prevents the fallback LLM logic from interfering with mocked tests
- os.environ["LDR_TESTING_WITH_MOCKS"] = "true"
+ # In CI, LDR_TESTING_WITH_MOCKS is set via Docker environment variables
+ # For local testing, set it here if not already set
+ if not os.environ.get("LDR_TESTING_WITH_MOCKS"):
+ os.environ["LDR_TESTING_WITH_MOCKS"] = "true"
@pytest.fixture(autouse=True)