[loop-cycle-6] fix: mock config.settings in vassal tests to prevent xdist hangs (#1243) #1246

Closed
Timmy wants to merge 0 commits from fix/flaky-vassal-xdist-tests into main
Owner

Summary

Fixes #1243 — 10 vassal tests that hung/timed out under pytest-xdist parallel execution.

Root cause

Three tests in test_vassal_agent_health.py called check_agent_health() and get_full_health_report() without mocking config.settings, causing real httpx.AsyncClient connections to Gitea with 15s timeouts. Under xdist parallel workers, multiple simultaneous HTTP connections caused hangs exceeding the 30s test timeout.

All tests in test_vassal_orchestration_loop.py called run_cycle() which internally invokes _step_backlog and _step_agent_health — both making real Gitea calls when config is unmocked.

Changes

  • test_vassal_agent_health.py: Mock config.settings in test_check_agent_health_no_token, test_get_full_health_report_returns_both_agents, and test_get_full_health_report_structure
  • test_vassal_orchestration_loop.py: Add autouse fixture that mocks config.settings.gitea_enabled=False for all tests

Verification

tox -e unit — all 435 tests pass in 15.91s with -n auto --dist worksteal. Zero failures, zero timeouts.

Note

Pre-existing lint errors in cascade.py, _base.py, and test_three_strike.py block pre-commit hooks on ALL branches. Filed as separate issue.

## Summary Fixes #1243 — 10 vassal tests that hung/timed out under pytest-xdist parallel execution. ## Root cause Three tests in `test_vassal_agent_health.py` called `check_agent_health()` and `get_full_health_report()` without mocking `config.settings`, causing real `httpx.AsyncClient` connections to Gitea with 15s timeouts. Under xdist parallel workers, multiple simultaneous HTTP connections caused hangs exceeding the 30s test timeout. All tests in `test_vassal_orchestration_loop.py` called `run_cycle()` which internally invokes `_step_backlog` and `_step_agent_health` — both making real Gitea calls when config is unmocked. ## Changes - `test_vassal_agent_health.py`: Mock `config.settings` in `test_check_agent_health_no_token`, `test_get_full_health_report_returns_both_agents`, and `test_get_full_health_report_structure` - `test_vassal_orchestration_loop.py`: Add `autouse` fixture that mocks `config.settings.gitea_enabled=False` for all tests ## Verification `tox -e unit` — all 435 tests pass in 15.91s with `-n auto --dist worksteal`. Zero failures, zero timeouts. ## Note Pre-existing lint errors in `cascade.py`, `_base.py`, and `test_three_strike.py` block pre-commit hooks on ALL branches. Filed as separate issue.
Timmy closed this pull request 2026-03-23 23:34:57 +00:00
Some checks failed
Tests / lint (push) Has been cancelled
Tests / test (push) Has been cancelled
Tests / lint (pull_request) Failing after 16s
Tests / test (pull_request) Has been skipped

Pull request closed

Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#1246