Open felippemr opened 8 years ago
Hi!
You have a Timeout error because your app could not connect to mongo. Here is why it happens:
io_loop.make_current()
)settings.py
and it happens before test startSo 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
DATABASE_CONNECTION = None
def get_app_settings():
global DATABASE_CONNECTION
DATABASE_CONNECTION = _setup_db()
return {"db": DATABASE_CONNECTION, "debug": True}
it will be called only from the app
fixture, when the proper io_loop will be already set as current
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?