test(update-autostash): include stdout in fake_run defaults so stale-dashboard scan doesn't crash#17149
Conversation
…dashboard scan doesn't crash `_cmd_update_impl` gained a new `subprocess.run(["ps", "-A", ...])` call in commit 66b1142 ("fix(cli): warn about stale dashboard processes after hermes update") that reads `result.stdout.split("\n")`. The two `cmd_update` integration tests in `test_update_autostash.py` mock `subprocess.run` with a catch-all `SimpleNamespace(returncode=0)` that omits `stdout`, so those tests now crash inside the new `_warn_stale_dashboard_processes()` with: AttributeError: 'types.SimpleNamespace' object has no attribute 'stdout' This has been a baseline `Tests` job failure on `origin/main` since 66b1142 landed — see for example the CI run on NousResearch#17123. Add `stdout=""`, `stderr=""` to the catch-all `SimpleNamespace` returns in `test_cmd_update_retries_optional_extras_individually_when_all_fails` and `test_cmd_update_succeeds_with_extras` so the new ps-scan call short-circuits as a no-match instead of raising. The other explicitly-matched returns in the same fixture are also extended for symmetry. No production code changes; the new behavior tests added in PR NousResearch#17074 / NousResearch#17123 already cover the production path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Fixes two cmd_update integration tests that started crashing after _warn_stale_dashboard_processes() began reading subprocess.run(...).stdout during hermes update.
Changes:
- Update the
fake_runsubprocess mock intest_update_autostash.pyto returnstdout/stderron default and pip-install branches. - Prevent
AttributeErrorwhen_warn_stale_dashboard_processes()runs during these tests by ensuring mocked results matchCompletedProcessshape more closely.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
CI audit — all 40 Reproduction: cloned
The Touched test ( |
|
Superseded by #17642 ("fix(ci): recover 38 failing tests on main") which already updated test_update_autostash to handle the stale-dashboard scan. Closing — happy to reopen if anything's still missing here. |
Summary
cmd_updateintegration tests intest_update_autostash.pyhave been crashing onorigin/mainsince the_warn_stale_dashboard_processes()call landed in_cmd_update_impl.The bug
Commit 66b1142 ("fix(cli): warn about stale dashboard processes after hermes update") added a new
call inside
_cmd_update_impland readsresult.stdout.split(\"\\n\"). The twocmd_updateintegration tests intests/hermes_cli/test_update_autostash.pymocksubprocess.runwith a catch-allSimpleNamespace(returncode=0)that omitsstdout. After 66b1142, both tests crash inside_warn_stale_dashboard_processeswith:Affected tests:
tests/hermes_cli/test_update_autostash.py::test_cmd_update_succeeds_with_extrastests/hermes_cli/test_update_autostash.py::test_cmd_update_retries_optional_extras_individually_when_all_failsReproduces deterministically on a clean clone of
origin/main(verified ata830f25f7).The fix
Add
stdout=\"\",stderr=\"\"to the catch-allSimpleNamespace(returncode=0)returns in both tests'fake_runso the new ps-scan finds zero dashboard processes and short-circuits cleanly. The two explicit pip-install branches that returned bareSimpleNamespace(returncode=0)are extended the same way for symmetry — no production behavior changes, only test fixture hygiene.This is intentionally test-only. The production path is already covered by the
_warn_stale_dashboard_processesregression tests added in #17123 (and the wmic-encoding fix in #17074).Test plan
uv run --with pytest --with pytest-xdist python3 -m pytest tests/hermes_cli/test_update_autostash.py -v— 23 passed, was 21 passed + 2 failed onorigin/main.uv run --with pytest --with pytest-xdist python3 -m pytest tests/hermes_cli/test_update_stale_dashboard.py -v— 10 passed (no regression).stdout=\"\"additions on a clean origin/main clone, reproduced the originalAttributeError: 'types.SimpleNamespace' object has no attribute 'stdout'failure with identical traceback athermes_cli/main.py:5309. Restored the fix, both tests pass.Related