test(slm): fix code_source_test.py collection — add python-multipart stub (#3525)#3532
Merged
mrveiss merged 2 commits intoDev_new_guifrom Apr 5, 2026
Merged
test(slm): fix code_source_test.py collection — add python-multipart stub (#3525)#3532mrveiss merged 2 commits intoDev_new_guifrom
mrveiss merged 2 commits intoDev_new_guifrom
Conversation
…stub (#3525) 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 <noreply@anthropic.com>
✅ SSOT Configuration Compliance: Passing🎉 No hardcoded values detected that have SSOT config equivalents! |
…threshold bumps
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 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
autobot-slm-backend/api/code_source_test.pycould not be collected by pytest because FastAPI'sensure_multipart_is_installed()fires at route-registration time when any endpoint usesUploadFileorForm.code_source_test.pyloadscode_source.pyviaimportlib.spec_from_file_locationat module level, triggering this check beforepython-multipartis available in the dev environment.python_multipartstub (types.ModuleTypewith__version__ = "0.0.99") toautobot-slm-backend/conftest.py— the same pattern already used for other missing packages in that file. FastAPI's check importspython_multipart.__version__and asserts> "0.0.12", so a stub version satisfies it without any real package.Test plan
python3 -m pytest autobot-slm-backend/api/code_source_test.py --collect-only -qshows15 tests collected(was1 error during collection)python3 -m pytest autobot-slm-backend/api/nodes_execution_test.py -qstill shows149 passedpython3 -m pytest autobot-slm-backend/api/nodes_execution_test.py autobot-slm-backend/api/code_source_test.py -qshows149 passed, 15 collected(12 pre-existing test-logic failures in code_source_test.py are unrelated to this issue)Closes #3525
🤖 Generated with Claude Code