From 78e3368b0e9d3cc1fb0f136686d223d8842eedf5 Mon Sep 17 00:00:00 2001 From: Anas Date: Sat, 9 May 2020 12:09:16 +0300 Subject: [PATCH] Added tests without explicit loop in TestAioHTTPTestCase --- tests/test_test_utils.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/test_test_utils.py b/tests/test_test_utils.py index 8df83981e5b..2f203853271 100644 --- a/tests/test_test_utils.py +++ b/tests/test_test_utils.py @@ -96,7 +96,7 @@ async def test_example_with_loop(self) -> None: text = await request.text() assert _hello_world_str == text - def test_example(self) -> None: + def test_inner_example(self) -> None: async def test_get_route() -> None: resp = await self.client.request("GET", "/") assert resp.status == 200 @@ -105,6 +105,21 @@ async def test_get_route() -> None: self.loop.run_until_complete(test_get_route()) + async def test_example_without_explicit_loop(self) -> None: + request = await self.client.request("GET", "/") + assert request.status == 200 + text = await request.text() + assert _hello_world_str == text + + async def test_inner_example_without_explicit_loop(self) -> None: + async def test_get_route() -> None: + resp = await self.client.request("GET", "/") + assert resp.status == 200 + text = await resp.text() + assert _hello_world_str == text + + await test_get_route() + def test_get_route(loop, test_client) -> None: async def test_get_route() -> None: