исправлено: убраны неиспользуемые импорты и переменные из tests/test_morning_runner.py

This commit is contained in:
deadzilla 2026-07-08 00:40:08 +05:00
parent 4e816d5998
commit 4b61909ebc

View File

@ -1,10 +1,8 @@
"""Тесты для utils/morning_runner.py — Scheduler и run_morning."""
import asyncio
from datetime import date, datetime
from unittest.mock import AsyncMock, MagicMock, patch, PropertyMock
from datetime import datetime
from unittest.mock import AsyncMock, MagicMock, patch
import discord
import pytest
from utils.morning_runner import Scheduler, run_morning
@ -31,7 +29,7 @@ class TestSchedulerInit:
"""Инициализация должна вызывать _start_scheduler."""
bot = AsyncMock()
with patch.object(Scheduler, "_start_scheduler") as mock_start:
scheduler = Scheduler(bot)
Scheduler(bot)
mock_start.assert_called_once()
@ -118,7 +116,7 @@ class TestRunMorning:
with patch("utils.morning_runner.fetch_weather", new=AsyncMock(return_value=weather_data)), \
patch("utils.morning_runner.fetch_rss", new=AsyncMock(side_effect=[articles, posts])), \
patch("utils.morning_runner.fetch_cat", new=AsyncMock(return_value="http://cat.jpg")), \
patch("utils.morning_runner.discord.Embed") as mock_embed:
patch("utils.morning_runner.discord.Embed"):
await run_morning(bot, channel)
channel.send.assert_called_once()