import pytest
from aiogram.filters import Command
from aiogram_tests import MockedBot
from aiogram_tests.handler import MessageHandler
from aiogram_tests.types.dataset import MESSAGE
============================= test session starts =============================
collecting ...
test_start.py:None (test_start.py)
ImportError while importing test module 'C:\Users\inver\PycharmProjects\aiogram3-bot-template\tests\test_start.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
..\venv\Lib\site-packages_pytest\python.py:617: in _importtestmodule
mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
..\venv\Lib\site-packages_pytest\pathlib.py:565: in import_path
importlib.import_module(module_name)
......\AppData\Local\Programs\Python\Python311\Lib\importlib__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
:1204: in _gcd_import
???
:1176: in _find_and_load
???
:1147: in _find_and_load_unlocked
???
:690: in _load_unlocked
???
..\venv\Lib\site-packages\_pytest\assertion\rewrite.py:178: in exec_module
exec(co, module.__dict__)
test_start.py:28: in
from aiogram_tests import MockedBot
..\venv\Lib\site-packages\aiogram_tests\__init__.py:1: in
from .requester import MockedBot
..\venv\Lib\site-packages\aiogram_tests\requester.py:1: in
from aiogram.utils.helper import Helper
E ModuleNotFoundError: No module named 'aiogram.utils.helper'
collected 0 items / 1 error
!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
============================== 1 error in 1.04s ===============================
I can't even run the basic example even though version aiogram==3.0.0b7.
Tell me please, what could be the problem? All code and error is attached below.
@router.message(Command(commands=["start"])) async def command_handler(message: Message, state: FSMContext) -> None: await message.answer("Hello, new user!")
import pytest from aiogram.filters import Command from aiogram_tests import MockedBot from aiogram_tests.handler import MessageHandler from aiogram_tests.types.dataset import MESSAGE
from handlers.users.start import command_handler
@pytest.mark.asyncio async def test_command_handler(): requester = MockedBot(MessageHandler(command_handler, Command(commands=["start"]))) calls = await requester.query(MESSAGE.as_object(text="/start")) answer_message = calls.send_message.fetchone().text assert answer_message == "Hi there! What's your name?"
============================= test session starts ============================= collecting ... test_start.py:None (test_start.py) ImportError while importing test module 'C:\Users\inver\PycharmProjects\aiogram3-bot-template\tests\test_start.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: ..\venv\Lib\site-packages_pytest\python.py:617: in _importtestmodule mod = import_path(self.path, mode=importmode, root=self.config.rootpath) ..\venv\Lib\site-packages_pytest\pathlib.py:565: in import_path importlib.import_module(module_name) ......\AppData\Local\Programs\Python\Python311\Lib\importlib__init__.py:126: in import_module return _bootstrap._gcd_import(name[level:], package, level)