Skip to content

test(slm): fix code_source_test.py collection — add python-multipart stub (#3525)#3532

Merged
mrveiss merged 2 commits intoDev_new_guifrom
fix/issue-3525
Apr 5, 2026
Merged

test(slm): fix code_source_test.py collection — add python-multipart stub (#3525)#3532
mrveiss merged 2 commits intoDev_new_guifrom
fix/issue-3525

Conversation

@mrveiss
Copy link
Copy Markdown
Owner

@mrveiss mrveiss commented Apr 5, 2026

Summary

  • autobot-slm-backend/api/code_source_test.py could not be collected by pytest because 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.spec_from_file_location at module level, triggering this check before python-multipart is available in the dev environment.
  • Added a python_multipart stub (types.ModuleType with __version__ = "0.0.99") to autobot-slm-backend/conftest.py — the same pattern already used for other missing packages in that file. FastAPI's check imports python_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 -q shows 15 tests collected (was 1 error during collection)
  • python3 -m pytest autobot-slm-backend/api/nodes_execution_test.py -q still shows 149 passed
  • python3 -m pytest autobot-slm-backend/api/nodes_execution_test.py autobot-slm-backend/api/code_source_test.py -q shows 149 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

…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>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

✅ 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>
@mrveiss mrveiss merged commit 46b4f8d into Dev_new_gui Apr 5, 2026
1 check passed
@mrveiss mrveiss deleted the fix/issue-3525 branch April 5, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant