Fix pytest state isolation for direct session saves#1136
Fix pytest state isolation for direct session saves#1136franksong2702 wants to merge 1 commit intonesquena:masterfrom
Conversation
|
Thanks for this, Frank — test isolation for pytest state is a real footgun and this addresses it cleanly. Review summary — LGTM with one absorb note The approach is correct: publishing Specifics that look good:
One small absorb at integration time: Merge plan: Queued for the next batch release. No further changes needed from you. |
337a6a0 to
6cd4732
Compare
|
Clean test-infrastructure fix — the |
* feat: attention state for broken cron jobs + Korean i18n (#1133, @franksong2702) * fix: pytest state isolation for direct session saves (#1136, @franksong2702) * fix(#1095): image thumbnails in composer + lightbox in chat (#1135) * fix(css): restore cron attention + detail-alert rules overwritten by style.css merge (absorb) * docs: v0.50.225 release notes and version bump --------- Co-authored-by: nesquena-hermes <[email protected]>
|
Merged in v0.50.225 via PR #1137. Thank you @franksong2702 — great contribution (pytest state isolation fix)! 🎉 |
…#1137) * feat: attention state for broken cron jobs + Korean i18n (nesquena#1133, @franksong2702) * fix: pytest state isolation for direct session saves (nesquena#1136, @franksong2702) * fix(nesquena#1095): image thumbnails in composer + lightbox in chat (nesquena#1135) * fix(css): restore cron attention + detail-alert rules overwritten by style.css merge (absorb) * docs: v0.50.225 release notes and version bump --------- Co-authored-by: nesquena-hermes <[email protected]>
Thinking Path
tests/test_sprint46.pyimportsapi.config.SESSION_DIRat collection time and then callsSession.save()directly from the pytest main process. Before this change,tests/conftest.pyonly passedHERMES_WEBUI_STATE_DIRto the test server subprocess, soapi.config.STATE_DIRcould fall back to the real~/.hermes/webuipath in pytest itself.What Changed
tests/conftest.pyat module import time, before test modules importapi.configorapi.models.tests/test_pytest_state_isolation.pyto lock the invariant thatapi.config.STATE_DIRandSESSION_DIRresolve under the isolated test state directory, not~/.hermes/webui.Why It Matters
Tests that save sessions directly in-process can no longer create or update files in the real WebUI session store. The server subprocess isolation and pytest main-process isolation now agree on the same test state root.
Verification
pytest tests/test_pytest_state_isolation.py tests/test_sprint46.py -qpytest tests/test_default_workspace_fallback.py -qpytest tests/test_onboarding_existing_config.py -qpytest tests/test_pytest_state_isolation.py tests/test_sprint46.py tests/test_default_workspace_fallback.py tests/test_onboarding_existing_config.py -q~/.hermes/webui/sessions/compress_test_001.jsonsentinel before and after the run; size and mtime were unchanged.Risks / Follow-ups
Model Used
GPT-5 Codex