fix: clear rate-limit hot-settings cache and add retry loop for maintenance-mode tests

- Invalidate `_hot_settings_value` and `_hot_settings_at` in `_patch_limits` so stale
  cached limits from prior tests do not persist after monkey-patching `get_int_setting`.
- Add a polling retry loop (up to 5 seconds) in `test_maintenance_mode_blocks_guests`
  to handle eventual consistency of the maintenance-mode flag propagation.
- Replace brittle hardcoded `@bob_test` assertion in mention test with dynamic
  `data-username` attribute extraction from the active dropdown item.
- Replace `asyncio.run` calls in bot unit tests with shared `run_async` helper from
  `tests.conftest` to avoid event-loop conflicts in the test suite.
- Change `insert` to `upsert` with `["uid"]` conflict target in Gitea test fixture
  to prevent duplicate-key errors on repeated test runs.
- Replace `asyncio.new_event_loop().run_until_complete` in Telegram worker tests
  with the same shared `run_async` helper for consistency.
This commit is contained in:
2026-06-19 23:21:53 +00:00
parent dc8ae8a099
commit a3dd747d07
6 changed files with 21 additions and 10 deletions
+3 -2
View File
@@ -94,7 +94,7 @@ def _make_user_issues_gitea():
_counter_issues_gitea[0] += 1
uid = f"issuetest-user-{_counter_issues_gitea[0]}"
username = f"issuetester{_counter_issues_gitea[0]}"
get_table("users").insert(
get_table("users").upsert(
{
"uid": uid,
"username": username,
@@ -102,7 +102,8 @@ def _make_user_issues_gitea():
"xp": 0,
"level": 1,
"is_active": True,
}
},
["uid"],
)
return uid, username
def _unread(user_uid):