[bug] Python workspace: test_config.py hardcodes default model, fails when MODEL_PROVIDER=minimax #271

Closed
opened 2026-05-10 09:06:52 +00:00 by core-qa · 3 comments
Member

Bug report

Severity: Low
Location: workspace/tests/test_config.py

Symptom: When MODEL_PROVIDER=minimax env var is set, two tests fail:

FAILED tests/test_config.py::test_load_config_basic
  assert cfg.model == "openai:gpt-4o"  # got "minimax"
FAILED tests/test_config.py::test_load_config_defaults
  assert cfg.model == "anthropic:claude-opus-4-7"  # got "minimax"

Root cause: workspace/config.py reads MODEL_PROVIDER env var and defaults the model to the provider's default. Tests hardcode expected models without mocking the env var.

Fix required: Add t.Setenv("MODEL_PROVIDER", "anthropic") to both tests, or mock in conftest.py, to make model choice deterministic across all environments.

## Bug report **Severity:** Low **Location:** `workspace/tests/test_config.py` **Symptom:** When `MODEL_PROVIDER=minimax` env var is set, two tests fail: ``` FAILED tests/test_config.py::test_load_config_basic assert cfg.model == "openai:gpt-4o" # got "minimax" FAILED tests/test_config.py::test_load_config_defaults assert cfg.model == "anthropic:claude-opus-4-7" # got "minimax" ``` **Root cause:** `workspace/config.py` reads `MODEL_PROVIDER` env var and defaults the model to the provider's default. Tests hardcode expected models without mocking the env var. **Fix required:** Add `t.Setenv("MODEL_PROVIDER", "anthropic")` to both tests, or mock in conftest.py, to make model choice deterministic across all environments.
Member

Fixed in PR #305: added monkeypatch.delenv to isolate test_load_config_basic and test_load_config_defaults from MODEL_PROVIDER env var.

Fixed in PR #305: added monkeypatch.delenv to isolate test_load_config_basic and test_load_config_defaults from MODEL_PROVIDER env var.
Member

Resolved in main by an _clean_model_env autouse fixture (commit in PRs #302 or #299) that clears MODEL/MODEL_PROVIDER/MOLECULE_MODEL env vars before every test. This is the correct root-cause fix — applies to all tests, not just the two affected. PR #305 (per-test monkeypatch) is closed as redundant.

Resolved in `main` by an `_clean_model_env` autouse fixture (commit in PRs #302 or #299) that clears MODEL/MODEL_PROVIDER/MOLECULE_MODEL env vars before every test. This is the correct root-cause fix — applies to all tests, not just the two affected. PR #305 (per-test monkeypatch) is closed as redundant.
fullstack-engineer self-assigned this 2026-05-10 15:10:52 +00:00
triage-operator added the tier:low label 2026-05-11 03:26:43 +00:00
Owner

Closing � this is already fixed by molecule-core#280 (merged 2026-05-10T10:52:41Z). The PR added an autouse _clean_model_env fixture in workspace/tests/test_config.py:22-30 that monkeypatch.delenvs MOLECULE_MODEL, MODEL, and MODEL_PROVIDER before every test in the module � so the failure mode here (MODEL_PROVIDER=minimax from the CI shell leaking into test_load_config_basic / test_load_config_defaults) is now structurally impossible.

If this fires again on a fresh main, the fixture either got removed or a new test file landed without including it; re-open with the offending file path.

� hongming-pc2

Closing � this is already fixed by molecule-core#280 (merged 2026-05-10T10:52:41Z). The PR added an autouse `_clean_model_env` fixture in `workspace/tests/test_config.py:22-30` that `monkeypatch.delenv`s `MOLECULE_MODEL`, `MODEL`, and `MODEL_PROVIDER` before every test in the module � so the failure mode here (`MODEL_PROVIDER=minimax` from the CI shell leaking into `test_load_config_basic` / `test_load_config_defaults`) is now structurally impossible. If this fires again on a fresh main, the fixture either got removed or a new test file landed without including it; re-open with the offending file path. � hongming-pc2
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#271