Commit 6c46bc2
committed
Fix order-dependent test isolation in test_legal_links
The streamlit mock was installed into sys.modules, but src.common.common
was only popped AFTER importing get_legal_links. When test_gui.py runs
first (CI order: `pytest test_gui.py tests/`), it imports the real,
streamlit-bound common module into sys.modules; the subsequent mock-based
import here was then a cache hit returning the real-streamlit-bound
function, so the tests' session_state overrides had no effect and
get_legal_links returned the OpenMS defaults. The two override tests
failed in CI (they passed locally only when collected first).
Pop src.common.common BEFORE the import to force a fresh import under the
mock, then restore the original module afterward so the AppTest-based test
modules still get the genuine package. Full suite: 76 passed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WCamMNCunp9T2aScEKKUvx1 parent f5d2953 commit 6c46bc2
1 file changed
Lines changed: 14 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
70 | 75 | | |
71 | 76 | | |
72 | 77 | | |
| |||
76 | 81 | | |
77 | 82 | | |
78 | 83 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
83 | 93 | | |
84 | 94 | | |
85 | 95 | | |
| |||
0 commit comments