vaflya
@vaflya
Ничего личного, это всего лишь хобби.

Как разобраться с асинхронностью в pytest?

В общем есть класс с тестами:
import pytest
import asyncio
import time

class TestBonus:
    async def test_a(self, user):
        time.sleep(40)
        print('dddddddd')

    def test_b(self, user):
        print('b')

    def test_c(self, user):
        print('b')

    def test_b(self, user):
        time.sleep(10)
        print('c')


в pycharm pytest выдает ошибку и игнорит асинхронный тест
SKIPPED/Users/wacker/decentury/np-eth/tests/venv/lib/python3.7/site-packages/_pytest/python.py:160: PytestUnhandledCoroutineWarning: async def functions are not natively supported and have been skipped.
You need to install a suitable plugin for your async framework, for example:
  - pytest-asyncio
  - pytest-trio
  - pytest-tornasync
  warnings.warn(PytestUnhandledCoroutineWarning(msg.format(pyfuncitem.nodeid)))

Skipped: async def function and no async plugin installed (see warnings)


Как я понял, нужен плагин? Без него не получится?
  • Вопрос задан
  • 1433 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы