diff --git a/tests/gateway/conftest.py b/tests/gateway/conftest.py index 978d634331a6..9cbc99fdd53f 100644 --- a/tests/gateway/conftest.py +++ b/tests/gateway/conftest.py @@ -184,6 +184,18 @@ def _ensure_discord_mock() -> None: self.description = description discord_mod.SelectOption = _FakeSelectOption + # AudioSource: real class so VoiceMixer(discord.AudioSource) can subclass + # it cleanly in tests. MagicMock auto-attributes would make is_opus() + # return a Mock instead of False, breaking 9 TestVoiceMixerCore tests. + class _FakeAudioSource: + def is_opus(self): + return False + def read(self): + return b"\x00" * 3840 # one silent stereo s16 frame + def cleanup(self): + pass + discord_mod.AudioSource = _FakeAudioSource + discord_mod.ui = SimpleNamespace( View=_FakeView, Select=_FakeSelect,