test+release: align send_message mocks for MessageEntity import; map @fonhal

This commit is contained in:
Teknium
2026-05-18 22:19:50 -07:00
parent cf814c96f6
commit 9a444a9355
3 changed files with 8 additions and 1 deletions
+4 -1
View File
@@ -48,7 +48,10 @@ def _make_config():
def _install_telegram_mock(monkeypatch, bot):
parse_mode = SimpleNamespace(MARKDOWN_V2="MarkdownV2", HTML="HTML")
constants_mod = SimpleNamespace(ParseMode=parse_mode)
telegram_mod = SimpleNamespace(Bot=lambda token: bot, constants=constants_mod)
# MessageEntity needed by #27865 mention-detection path; tests don't
# inspect it but the import must succeed.
_MessageEntity = lambda **_kw: SimpleNamespace(**_kw)
telegram_mod = SimpleNamespace(Bot=lambda token: bot, MessageEntity=_MessageEntity, constants=constants_mod)
monkeypatch.setitem(sys.modules, "telegram", telegram_mod)
monkeypatch.setitem(sys.modules, "telegram.constants", constants_mod)