diff --git a/tests/gateway/test_teams.py b/tests/gateway/test_teams.py index 7a035142..2100a264 100644 --- a/tests/gateway/test_teams.py +++ b/tests/gateway/test_teams.py @@ -397,13 +397,22 @@ class TestTeamsSend: assert "Network error" in result.error @pytest.mark.asyncio - async def test_send_typing(self): + async def test_send_typing(self, monkeypatch): adapter = TeamsAdapter(_make_config( client_id="id", client_secret="secret", tenant_id="tenant", )) mock_app = MagicMock() mock_app.send = AsyncMock() adapter._app = mock_app + # The adapter module imports TypingActivityInput at load time; if + # the real microsoft_teams package isn'"'"'t installed, that local + # binding is None even though the test fixture registers a mock + # in sys.modules. Force a non-None local binding so the call to + # TypingActivityInput() inside send_typing succeeds and we actually + # reach self._app.send. + class _StubTypingActivityInput: + pass + monkeypatch.setattr(_teams_mod, "TypingActivityInput", _StubTypingActivityInput) await adapter.send_typing("conv-id") mock_app.send.assert_awaited_once()