Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: cannot import name 'transfer_markers' when testing with pytest

Tags:

python

pytest

When I run tests for my python project by running the following command:

python setup.py test
(or)
pytest project_name

I get the following error:

.../project_name/.eggs/pytest_asyncio-0.9.0-py3.6.egg/pytest_asyncio/plugin.py", line 8, in <module>
from _pytest.python import transfer_markers

ImportError: cannot import name 'transfer_markers'
like image 528
nitred Avatar asked Jan 06 '19 19:01

nitred


1 Answers

pytest-asyncio has been updated to 0.10.0

pytest-asyncio is using transfer_markers which is taken out in pytest 4.1.0. Looks like it's fixed and released. Issue#105

EDIT: You can now upgrade pip install pytest-asyncio==0.10.0 to fix this issue.

Or update pytest-asyncio==0.10.0 in your requirements.txt

Don't forget to run pip uninstall pytest to keep your pytest up-to-date if you previously installed pytest 4.0.2 to temporarily fix the issue

like image 76
M.Jin Avatar answered Sep 29 '22 06:09

M.Jin