test(on-demand): find the config write by key, not by position (#763)

The font-usage publisher thread writes its own cache key at its own pace;
the last set() call is not always the on-demand config. Same race #751
fixed for the restore-failed state test.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chuck
2026-10-04 19:27:51 -04:00
committed by GitHub
co-authored by Claude Opus 5.5
parent d447cdd965
commit 378478124c
+4 -2
View File
@@ -87,8 +87,10 @@ class TestANamedLiveModeIsShown:
def test_the_named_mode_survives_a_restart(self, football):
football._activate_on_demand({'plugin_id': 'football-scoreboard',
'mode': 'ncaa_fb_live'})
saved = football.cache_manager.set.call_args_list[-1]
assert saved.args[0] == 'display_on_demand_config'
# The last on-demand config write, not the last write of any key: the
# font-usage publisher thread writes its own key at its own pace.
saved = [c for c in football.cache_manager.set.call_args_list
if c.args and c.args[0] == 'display_on_demand_config'][-1]
config = saved.args[1]
assert config['named_mode'] == 'ncaa_fb_live'