August 2018
Beginner
160 pages
4h 8m
English
Tornado (http://www.tornadoweb.org/en/stable/) is a web framework and asynchronous network library. It is very mature, works in Python 2 and 3, and the standard asyncio module borrowed many ideas and concepts from it.
pytest-asyncio was heavily inspired by pytest-tornado, so it works with the same idea of using a gen_test to mark your test as a coroutine. It uses the yield keyword instead of await, as it supports Python 2, but otherwise it looks very similar:
@pytest.mark.gen_testdef test_tornado(http_client): url = "https://docs.pytest.org/en/latest" response = yield http_client.fetch(url) assert response.code == 200
Read now
Unlock full access