[loop-cycle-3] fix: isolate unit tests from local .env and real Gitea API #1206
Reference in New Issue
Block a user
Delete Branch "fix/test-env-isolation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
5 unit tests failing on main due to environment bleed:
test_config.py(4 failures):_make_settings()patchedos.environbut Pydantic's BaseSettings still read the.envfile, picking up local overrides (OLLAMA_MODEL=qwen3:30b,GROK_ENABLED=true,GITEA_URL=http://143.198.27.163:3000)test_vassal_agent_health.py(1 failure):test_nudge_stuck_agent_no_tokenhit the real Gitea API becauseconfig.settingshad a real token from.envFix
_make_settings(): temporarily setSettings.model_config['env_file'] = Noneto prevent.envfile reading during tests, restored infinallyblocktest_nudge_stuck_agent_no_token: mockconfig.settingswithgitea_enabled=Falseand emptygitea_tokenVerification
343 passed, 0 failed (was 5 failed)
Fixes test failures on main.