From d22a1ee5bec8d04d51bca0d59b0a42b7d5b24d8e Mon Sep 17 00:00:00 2001 From: Carlos Diosdado Date: Tue, 16 Jun 2026 15:54:42 -0600 Subject: [PATCH] fix(tests): add _FakeAudioSource to discord mock for VoiceMixer inheritance --- tests/gateway/conftest.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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,