diff --git a/autobot-slm-backend/conftest.py b/autobot-slm-backend/conftest.py index 744f37c02..43f719482 100644 --- a/autobot-slm-backend/conftest.py +++ b/autobot-slm-backend/conftest.py @@ -101,6 +101,16 @@ def _stub(name: str) -> MagicMock: ]: _stub(_m) +# ── python-multipart ───────────────────────────────────────────────────────── +# FastAPI's ensure_multipart_is_installed() is called when any route uses +# UploadFile or Form parameters. It checks for python_multipart.__version__ +# at route-registration time (import time for the router module). Stub it +# so that code_source_test.py can import code_source.py without the package +# being installed in the dev environment. Issue: #3525 +_pm_mod = types.ModuleType("python_multipart") +_pm_mod.__version__ = "9.9.99" # type: ignore[attr-defined] # high sentinel — immune to future FastAPI threshold bumps +sys.modules.setdefault("python_multipart", _pm_mod) + # ── user_management ─────────────────────────────────────────────────────────── for _m in [ "user_management",