~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
fix(test): restore original security modules after import-fallback tests (#5029)
LearningCircuitf817ee0c4358
diff --git a/changelog.d/+security-fixture-module-identity.misc.md b/changelog.d/+security-fixture-module-identity.misc.mdnew file mode 100644index 0000000000..d1330f8f60--- /dev/null+++ b/changelog.d/+security-fixture-module-identity.misc.md@@ -0,0 +1 @@+Fixed an order-dependent test flake: the security import-fallback tests replaced `local_deep_research.security*` modules with fresh copies, recreating enums like `Sensitivity` and breaking identity checks in tests that ran later on the same worker.diff --git a/tests/security/test_security_import_fallbacks_coverage.py b/tests/security/test_security_import_fallbacks_coverage.pyindex d00024bd7b..e0a4098820 100644--- a/tests/security/test_security_import_fallbacks_coverage.py+++ b/tests/security/test_security_import_fallbacks_coverage.py@@ -31,20 +31,33 @@ def _reload_security_with_blocked(blocked_submodule):@pytest.fixture(autouse=True)def _restore_security_module():- """Ensure security module is fully restored after each test."""+ """Restore the exact pre-test security module objects after each test.++ Re-importing fresh copies instead would recreate classes/enums (e.g.+ egress classification's Sensitivity), breaking identity checks in any+ test that runs later in the same process against modules that imported+ them earlier.+ """+ saved = {+ k: v+ for k, v in sys.modules.items()+ if "local_deep_research.security" in k+ }yield- # Force fresh re-import- modules_to_remove = [+ for k in [k for k in list(sys.modules) if "local_deep_research.security" in k- ]- for k in modules_to_remove:+ ]:sys.modules.pop(k, None)- try:- import local_deep_research.security-- importlib.reload(local_deep_research.security)- except Exception:- pass+ sys.modules.update(saved)+ # Re-bind each restored module on its parent package: the blocked+ # reload replaced parent attributes (e.g. local_deep_research.security),+ # and `from local_deep_research import security` resolves through that+ # attribute, not through sys.modules.+ for name, module in saved.items():+ parent_name, _, child = name.rpartition(".")+ parent = sys.modules.get(parent_name)+ if parent is not None and child:+ setattr(parent, child, module)class TestPathValidatorImportFallback: