From f1801990dff4d8d4c6d76d137535124bf18da784 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Sat, 4 Jun 2016 12:32:16 -0700 Subject: [PATCH] Fix test server finalization procedure --- aiohttp/test_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aiohttp/test_utils.py b/aiohttp/test_utils.py index 333c7d8ea41..a3a5aa2d610 100644 --- a/aiohttp/test_utils.py +++ b/aiohttp/test_utils.py @@ -417,10 +417,11 @@ def close(self): if not self._closed: loop = self._loop loop.run_until_complete(self._session.close()) - loop.run_until_complete(self._handler.finish_connections()) - loop.run_until_complete(self.app.finish()) self._server.close() loop.run_until_complete(self._server.wait_closed()) + loop.run_until_complete(self.app.shutdown()) + loop.run_until_complete(self._handler.finish_connections()) + loop.run_until_complete(self.app.cleanup()) self._closed = True def __del__(self):