Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No module named 'aiogram.utils.helper' #19

Open
Oldweedkeeper2 opened this issue Sep 2, 2023 · 1 comment
Open

No module named 'aiogram.utils.helper' #19

Oldweedkeeper2 opened this issue Sep 2, 2023 · 1 comment

Comments

@Oldweedkeeper2
Copy link

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)
: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 ===============================

@kmmbvnr
Copy link

kmmbvnr commented Sep 5, 2023

Looks it has been fixed in the git version ffb97eb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants