You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You have a Timeout error because your app could not connect to mongo.
Here is why it happens:
pytest-tornado creates and start its own io_loop for each test method (and make it current io_loop.make_current())
you initialize motor client in global scope of settings.py and it happens before test start
motor client expects to be run in default io_loop, but it will never be started, because pytest-tornado creates its own loops and doesn't touch default io_loop
So the best practice to work with pytest-tornado will be initializating stuff in functions/fixtures, but not in a global scope.
So you can solve your problem by changing settings.py like this
Hey @etataurov - got similar problems with timeouts when using asyncio (and related aioredis) - maybe note in readme about changing default io_loop to something like this:
@pytest.fixture
def io_loop():
from tornado.platform.asyncio import AsyncIOMainLoop
return AsyncIOMainLoop()
could help others, when dealing with async? I spent some time on that, before realizing on the real problem.
Hi!
I am learning tornado and to do so I created a project: https://github.com/felippemr/resistance
I am trying to change my test suite to use pytest-tornado but I keep receiving this error:
I'm doing this test(it will fail):
Can you please help me?
The text was updated successfully, but these errors were encountered: