Various test fixes
This commit is contained in:
+29
-25
@@ -103,7 +103,7 @@ def custom_bot_manager(temp_db_path: str) -> CustomBotManager:
|
||||
from vibe_bot.database import CustomBotManager
|
||||
|
||||
manager = CustomBotManager(db_path=temp_db_path)
|
||||
return manager # noqa: RET504
|
||||
return manager
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -123,16 +123,16 @@ def mock_kokoro_tts() -> Generator[dict[str, Any]]:
|
||||
return_value=mock_kokoro_instance,
|
||||
),
|
||||
patch("vibe_bot.tts.chunk_text", mock_chunk),
|
||||
patch("vibe_bot.tts.process_chunk_sequential", mock_process),
|
||||
):
|
||||
with patch("vibe_bot.tts.process_chunk_sequential", mock_process):
|
||||
yield {
|
||||
"Kokoro": mock_kokoro,
|
||||
"chunk_text": mock_chunk,
|
||||
"process_chunk_sequential": mock_process,
|
||||
"kokoro_instance": mock_kokoro_instance,
|
||||
"mock_samples": mock_samples,
|
||||
"mock_sr": 24000,
|
||||
}
|
||||
yield {
|
||||
"Kokoro": mock_kokoro,
|
||||
"chunk_text": mock_chunk,
|
||||
"process_chunk_sequential": mock_process,
|
||||
"kokoro_instance": mock_kokoro_instance,
|
||||
"mock_samples": mock_samples,
|
||||
"mock_sr": 24000,
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -148,18 +148,20 @@ def mock_discord() -> Generator[dict[str, MagicMock]]:
|
||||
mock_bot_instance.user.name = "test-bot"
|
||||
mock_bot_instance.user.id = "123456789"
|
||||
|
||||
with patch("vibe_bot.main.discord") as mock_discord_module:
|
||||
with patch("vibe_bot.main.commands", MagicMock()):
|
||||
with patch("vibe_bot.main.commands.Bot", mock_bot_class):
|
||||
mock_bot_class.return_value = mock_bot_instance
|
||||
mock_discord_module.Intents = mock_intents
|
||||
mock_discord_module.Message = MagicMock
|
||||
mock_discord_module.File = MagicMock
|
||||
yield {
|
||||
"Intents": mock_intents,
|
||||
"Bot": mock_bot_class,
|
||||
"bot_instance": mock_bot_instance,
|
||||
}
|
||||
with (
|
||||
patch("vibe_bot.main.discord") as mock_discord_module,
|
||||
patch("vibe_bot.main.commands", MagicMock()),
|
||||
patch("vibe_bot.main.commands.Bot", mock_bot_class),
|
||||
):
|
||||
mock_bot_class.return_value = mock_bot_instance
|
||||
mock_discord_module.Intents = mock_intents
|
||||
mock_discord_module.Message = MagicMock
|
||||
mock_discord_module.File = MagicMock
|
||||
yield {
|
||||
"Intents": mock_intents,
|
||||
"Bot": mock_bot_class,
|
||||
"bot_instance": mock_bot_instance,
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -167,9 +169,11 @@ def mock_tts_engine() -> Generator[MagicMock]:
|
||||
"""Provide a mock TTSEngine."""
|
||||
mock_engine = MagicMock()
|
||||
mock_engine.generate_audio.return_value = MagicMock()
|
||||
with patch("vibe_bot.main.tts_engine", mock_engine):
|
||||
with patch("vibe_bot.main.tts.TTSEngine", return_value=mock_engine):
|
||||
yield mock_engine
|
||||
with (
|
||||
patch("vibe_bot.main.tts_engine", mock_engine),
|
||||
patch("vibe_bot.main.tts.TTSEngine", return_value=mock_engine),
|
||||
):
|
||||
yield mock_engine
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
Reference in New Issue
Block a user