Here are the examples of the python api aiohttp.test_utils.loop_context taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
4 Examples
3
Example 1
Project: aiohttp Source File: test_test_utils.py
def test_full_server_scenario():
with loop_context() as loop:
app = _create_example_app(loop)
with _TestClient(app) as client:
@asyncio.coroutine
def test_get_route():
nonlocal client
resp = yield from client.request("GET", "/")
assert resp.status == 200
text = yield from resp.text()
assert "Hello, world" in text
loop.run_until_complete(test_get_route())
3
Example 2
Project: aiohttp Source File: test_test_utils.py
def test_server_with_create_test_teardown():
with loop_context() as loop:
app = _create_example_app(loop)
with _TestClient(app) as client:
@asyncio.coroutine
def test_get_route():
resp = yield from client.request("GET", "/")
assert resp.status == 200
text = yield from resp.text()
assert "Hello, world" in text
loop.run_until_complete(test_get_route())
0
Example 3
@pytest.yield_fixture
def loop():
with loop_context() as loop:
yield loop
0
Example 4
@pytest.yield_fixture(params=LOOP_FACTORIES)
def loop(request):
with loop_context(request.param) as loop:
yield loop