ImportError: cannot import name 'transfer_markers' when testing with pytest
When I looked it up online, there was almost no mention of that particular error message anywhere. Something similar has happened to me a few times before where previously working code just breaks and it's usually because there's a new version of an important package.
I looked at the pytest release history, and it looks like pytest==4.1.0
has been released a few hours ago (as of this post).
The solution is to revert back to the last stable version of pytest i.e. pytest==4.0.2
by running the following command:
pip install pytest==4.0.2
The tests are running now.
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