diff --git a/aiogram/dispatcher/dispatcher.py b/aiogram/dispatcher/dispatcher.py index eec8497e..4984b212 100644 --- a/aiogram/dispatcher/dispatcher.py +++ b/aiogram/dispatcher/dispatcher.py @@ -153,5 +153,6 @@ class Dispatcher(Router): """ try: return asyncio.run(self._run_polling(*bots, **kwargs)) - except (KeyboardInterrupt, SystemExit): # Allow to graceful shutdown + except (KeyboardInterrupt, SystemExit): # pragma: no cover + # Allow to graceful shutdown pass diff --git a/tests/test_dispatcher/test_dispatcher.py b/tests/test_dispatcher/test_dispatcher.py index a0552085..42abb826 100644 --- a/tests/test_dispatcher/test_dispatcher.py +++ b/tests/test_dispatcher/test_dispatcher.py @@ -189,6 +189,8 @@ class TestDispatcher: mocked_process_update.assert_awaited() mocked_emit_shutdown.assert_awaited() - @pytest.mark.skip - def test_run(self): - pass + def test_run(self, bot: MockedBot): + dispatcher = Dispatcher() + with patch("aiogram.dispatcher.dispatcher.Dispatcher._run_polling") as patched_run_polling: + dispatcher.run(bot) + patched_run_polling.assert_awaited_once()