Created At: 2026-11-18T07:53:32Z Completed At: 2026-11-18T07:53:37Z Command exited with code 1. Command output: ============================= test session starts ============================== platform linux -- Python 3.12.3, pytest-9.2.0, pluggy-1.7.0 -- /root/telegram-saas/.venv/bin/python3 cachedir: .pytest_cache rootdir: /root/telegram-saas configfile: pyproject.toml plugins: anyio-4.16.0, asyncio-1.5.0 asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function collecting ... collected 1 item tests/integration/test_celery_telegram_tasks.py::test_celery_telegram_update_task_execution FAILED [100%] =================================== FAILURES =================================== __________________ test_celery_telegram_update_task_execution __________________ db_session = @pytest.mark.asyncio async def test_celery_telegram_update_task_execution(db_session: AsyncSession): # 1. Create Tenant tenant_id = uuid.uuid4() tenant = Tenant( id=tenant_id, name="Celery Task Tenant", slug=f"celery-tenant-{uuid.uuid4().hex[:6]}", status="active", plan_id="enterprise", ) db_session.add(tenant) await db_session.commit() # 2. Register mock bot token = f"celery_test_token_{uuid.uuid4().hex[:8]}_test" TelegramApiService.register_mock_bot(token, "celery_bot", "Celery Bot") service = BotService(db_session) bot = await service.register_bot( tenant_id=tenant_id, req=BotRegisterRequest(token=token, name="Celery Bot", default_locale="en"), ) await db_session.commit() # 3. Setup known webhook secret known_secret = "secret_for_celery_task_verification_123" webhook = await service.repo.get_webhook(bot.id) webhook.secret_hash = hash_webhook_secret(known_secret) await db_session.commit() # 4. Invoke Celery Task update_payload = { "update_id": 8801, "message": { "message_id": 70, "from": { "id": 554433, "first_name": "CeleryUser", "username": "celery_user", "language_code": "en", }, "chat": {"id": 554433}, "text": "/start", }, } > result = process_telegram_update_task( bot_id_str=str(bot.id), received_secret=known_secret, update_dict=update_payload, tenant_id_str=str(tenant_id), ) tests/integration/test_celery_telegram_tasks.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ .venv/lib/python3.12/site-packages/celery/local.py:183: in __call__ return self._get_current_object()(*a, **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .venv/lib/python3.12/site-packages/celery/app/task.py:550: in __call__ return self.run(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ apps/worker/tasks/telegram.py:49: in process_telegram_update_task raise self.retry(exc=exc) ^^^^^^^^^^^^^^^^^^^ .venv/lib/python3.12/site-packages/celery/app/task.py:889: in retry raise_with_context(exc or Retry('Task can be retried', None)) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <@task: apps.worker.tasks.telegram.process_telegram_update_task of default at 0x79aeb0ba1d30> bot_id_str = '187396ed-3f92-4468-9ab8-5410536504db' received_secret = 'secret_for_celery_task_verification_123' update_dict = {'update_id': 8801, 'message': {'message_id': 70, 'from': {'id': 554433, 'first_name': 'CeleryUser', 'username': 'celery_user', 'language_code': 'en'}, 'chat': {'id': 554433}, 'text': '/start'}} tenant_id_str = 'e5a6d752-3a4a-4f2e-b068-062ba160d805' @shared_task( bind=True, name="apps.worker.tasks.telegram.process_telegram_update_task", max_retries=3, default_retry_delay=5, acks_late=True, ) def process_telegram_update_task(self, bot_id_str: str, received_secret: str, update_dict: dict, tenant_id_str: str): """ Celery background task for asynchronous Telegram update processing. Propagates tenant context to ensure complete tenant data isolation. """ tenant_id = UUID(tenant_id_str) bot_id = UUID(bot_id_str) set_current_tenant_id(tenant_id) logger.info("processing_telegram_update_in_celery", bot_id=bot_id_str, tenant_id=tenant_id_str) async def _run(): async with get_db_session() as db: service = BotService(db) return await service.handle_webhook_update( bot_id=bot_id, received_secret_token=received_secret, update_dict=update_dict, ) try: loop = asyncio.get_event_loop() if loop.is_running(): > import nest_asyncio E ModuleNotFoundError: No module named 'nest_asyncio' apps/worker/tasks/telegram.py:42: ModuleNotFoundError ----------------------------- Captured stdout call ----------------------------- 2026-11-18 07:53:36 [info ] bot_registered_successfully bot_id=187396ed-3f92-4468-9ab8-5410536504db tenant_id=e5a6d752-3a4a-4f2e-b068-062ba160d805 username=celery_bot 2026-11-18 07:53:36 [info ] processing_telegram_update_in_celery bot_id=187396ed-3f92-4468-9ab8-5410536504db tenant_id=e5a6d752-3a4a-4f2e-b068-062ba160d805 2026-11-18 07:53:36 [error ] celery_telegram_update_failed bot_id=187396ed-3f92-4468-9ab8-5410536504db error="No module named 'nest_asyncio'" =========================== short test summary info ============================ FAILED tests/integration/test_celery_telegram_tasks.py::test_celery_telegram_update_task_execution ============================== 1 failed in 0.57s ===============================