mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-29 18:46:59 +00:00
fix(tests): add _FakeAudioSource to discord mock for VoiceMixer inheritance
This commit is contained in:
parent
eef1ab72d5
commit
d22a1ee5be
1 changed files with 12 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue