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

This commit is contained in:
Teknium 2026-05-18 22:19:45 -07:00
parent cf814c96f6
commit 9a444a9355
3 changed files with 8 additions and 1 deletions

View file

@ -170,6 +170,7 @@ AUTHOR_MAP = {
"cryptobyz.airdrop@gmail.com": "CryptoByz", # PR #25630 salvage (polling conflict Stage 1+2)
"fabioxxx@gmail.com": "fabiosiqueira", # PR #27212 salvage (bg-process notif anchor)
"lordfalcon.exe@gmail.com": "falconexe", # PR #24511 salvage (sticky-IP reset)
"fonhal@gmail.com": "fonhal", # PR #27865/#27861 salvage (mention entities / typing fallback)
"androidhtml@yandex.com": "hllqkb",
"25840394+Bongulielmi@users.noreply.github.com": "Bongulielmi",
"jonathan.troyer@overmatch.com": "JTroyerOvermatch",

View file

@ -37,8 +37,11 @@ def _install_telegram_mock_with_request(
parse_mode = SimpleNamespace(MARKDOWN_V2="MarkdownV2", HTML="HTML")
constants_mod = SimpleNamespace(ParseMode=parse_mode)
request_mod = SimpleNamespace(HTTPXRequest=httpx_request_factory)
# MessageEntity needed by #27865 mention-detection path.
_MessageEntity = lambda **_kw: SimpleNamespace(**_kw)
telegram_mod = SimpleNamespace(
Bot=bot_factory,
MessageEntity=_MessageEntity,
constants=constants_mod,
request=request_mod,
)

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)