From d0c9df96240d299f156ea517ea2f25fc8517e8a9 Mon Sep 17 00:00:00 2001 From: mrveiss Date: Sun, 5 Apr 2026 23:09:46 +0300 Subject: [PATCH 1/2] =?UTF-8?q?test(slm):=20fix=20code=5Fsource=5Ftest.py?= =?UTF-8?q?=20collection=20=E2=80=94=20add=20python-multipart=20stub=20(#3?= =?UTF-8?q?525)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FastAPI's ensure_multipart_is_installed() fires at route-registration time when any endpoint uses UploadFile or Form. code_source_test.py loads code_source.py via importlib at module level, which triggers this check before python-multipart is available in the dev environment. Add a python_multipart stub (types.ModuleType with __version__ = "0.0.99") to autobot-slm-backend/conftest.py so the check passes without the package being installed. 15 tests now collected; 149 nodes_execution tests unaffected. Co-Authored-By: Claude Sonnet 4.6 --- autobot-slm-backend/conftest.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/autobot-slm-backend/conftest.py b/autobot-slm-backend/conftest.py index 744f37c02..b31e84cd6 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__ = "0.0.99" # type: ignore[attr-defined] +sys.modules.setdefault("python_multipart", _pm_mod) + # ── user_management ─────────────────────────────────────────────────────────── for _m in [ "user_management", From 1f8627ef78a24aa630a633f8da9f47d5c9237d80 Mon Sep 17 00:00:00 2001 From: mrveiss Date: Sun, 5 Apr 2026 23:25:04 +0300 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20bump=20python=5Fmultipart=20stub=20t?= =?UTF-8?q?o=209.9.99=20=E2=80=94=20immune=20to=20future=20FastAPI=20thres?= =?UTF-8?q?hold=20bumps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FastAPI uses string comparison (assert __version__ > "0.0.12"), so "0.0.99" would silently break if FastAPI ever raised its threshold to "0.0.100" ("0.0.100" < "0.0.99" lexicographically). "9.9.99" is a high sentinel that will pass any plausible future threshold. python-multipart is already declared in both requirements.txt and requirements-ci.txt (>=0.0.22); the stub is only a dev-environment safety net when the real package is not installed. Co-Authored-By: Claude Sonnet 4.6 --- autobot-slm-backend/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autobot-slm-backend/conftest.py b/autobot-slm-backend/conftest.py index b31e84cd6..43f719482 100644 --- a/autobot-slm-backend/conftest.py +++ b/autobot-slm-backend/conftest.py @@ -108,7 +108,7 @@ def _stub(name: str) -> MagicMock: # 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__ = "0.0.99" # type: ignore[attr-defined] +_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 ───────────────────────────────────────────────────────────