I am trying to run pytest on my aiohttp application.
I have added a “pytest.ini” config file.
But whenever i run pytest, it simply gives me an error. It never complies my test_file.
My config file looks like this: “”” pytest.ini “””
[pytest]
addopts = --asyncio
When i run pytest along with this config file, it doesn’t allow my code to be run and shows this error:
$ pytest
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] […]
pytest: error: unrecognized arguments: –asyncio
and when i remove my config file, it shows this:
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:
– anyio
– pytest-asyncio
– pytest-tornasync
– pytest-trio
– pytest-twisted
warnings.warn(PytestUnhandledCoroutineWarning(msg.format(nodeid)))
But I have installed pytest-asyncio in my environment and it is working fine.