Просмотр исходного кода

Improve aiohttp server cleanup in tests

Jelmer Vernooij 2 недель назад
Родитель
Сommit
e9a9031deb
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      tests/compat/test_aiohttp.py

+ 2 - 2
tests/compat/test_aiohttp.py

@@ -88,13 +88,13 @@ class AiohttpServerTests(ServerTests):
         # Cleanup function
         # Cleanup function
         def cleanup():
         def cleanup():
             async def stop():
             async def stop():
+                await site.stop()
                 await runner.cleanup()
                 await runner.cleanup()
 
 
             future = asyncio.run_coroutine_threadsafe(stop(), loop)
             future = asyncio.run_coroutine_threadsafe(stop(), loop)
             future.result(timeout=5)
             future.result(timeout=5)
             loop.call_soon_threadsafe(loop.stop)
             loop.call_soon_threadsafe(loop.stop)
-            thread.join(timeout=1.0)
-            # Close the event loop to avoid ResourceWarning
+            thread.join()
             loop.close()
             loop.close()
 
 
         self.addCleanup(cleanup)
         self.addCleanup(cleanup)