Skip to content

test(slm): api/code_source_test.py cannot be collected — python-multipart missing from dev dependencies #3525

@mrveiss

Description

@mrveiss

Problem

After PR #3511 added autobot-slm-backend/conftest.py to fix the `api/init.py` collection blocker, `api/code_source_test.py` still cannot be collected:

```
ERROR autobot-slm-backend/api/code_source_test.py - RuntimeError: Form data requires "python-multipart" to be installed.
```

This is a separate issue from #3499 — the hollow-api-module strategy correctly prevents `api/init.py` from running, but `code_source_test.py` itself imports a form-handling route that triggers FastAPI's multipart validation at import time.

Root cause

`api/code_source.py` uses FastAPI's `UploadFile` / `Form` types. When FastAPI validates the route signature at class-definition time (import time), it checks for `python-multipart`. The package is not listed in the SLM backend's dev requirements.

Reproduction

```bash
python3 -m pytest autobot-slm-backend/api/code_source_test.py --collect-only

ERROR: RuntimeError: Form data requires "python-multipart" to be installed.

```

Fix

Add `python-multipart` to the SLM backend's dev/test dependencies, e.g. in `autobot-slm-backend/requirements*.txt` or `pyproject.toml`.

Alternatively, if `code_source_test.py` uses the same `importlib.util.spec_from_file_location` pattern as `nodes_execution_test.py` (loading the module directly), verify that `python-multipart` is stubbed before the import or that the route registration is deferred.

Discovered during

Session 38 implementation of #3499 — confirmed as pre-existing (failure present before conftest.py was added).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions