fix(tests): add _FakeAudioSource to discord mock for VoiceMixer inheritance
This commit is contained in:
parent
eef1ab72d5
commit
d22a1ee5be
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue