From 378478124c48489d734a22d638fa7ffe602fd307 Mon Sep 17 00:00:00 2001 From: Chuck <33324927+ChuckBuilds@users.noreply.github.com> Date: Sun, 4 Oct 2026 19:27:51 -0400 Subject: [PATCH] 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 --- test/test_on_demand_live_and_restore.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/test_on_demand_live_and_restore.py b/test/test_on_demand_live_and_restore.py index ee74f0a5..f5c62f3c 100644 --- a/test/test_on_demand_live_and_restore.py +++ b/test/test_on_demand_live_and_restore.py @@ -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'