Commit e2bfe05
Fix test_mode propagation by updating module-level variables
Root cause: When settings.py is first imported, module-level variables like
test_mode are set from sg_config at import time (line 725). Later, when test
fixtures call load_config(test_mode=True), it updates sg_config._test_mode
but the module-level variable stays stale.
The _test_mode property in BaseMixin does:
from spyglass.settings import test_mode
return test_mode # Returns stale module-level variable!
This caused electrode validation to run during tests even though test_mode
should be True, because it was checking the stale module variable that was
set to False at initial import.
Fix: Update module-level variables (test_mode, debug_mode) at the end of
load_config() so they reflect the current config state.
This is why PR #1454's electrode validation worked on master but failed when
merged with our branch - subtle import order differences meant our branch
triggered settings import earlier, before fixtures could update test_mode.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent d99d873 commit e2bfe05
1 file changed
+7
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
323 | 330 | | |
324 | 331 | | |
325 | 332 | | |
| |||
0 commit comments