[Python-checkins] bpo-31250, test_asyncio: fix EventLoopTestsMixin.tearDown() (#3264)

Victor Stinner webhook-mailer at python.org
Fri Sep 1 18:25:42 EDT 2017


https://github.com/python/cpython/commit/e8a533fbc734af6eeb389202ba6c6e9c2548027f
commit: e8a533fbc734af6eeb389202ba6c6e9c2548027f
branch: master
author: Victor Stinner <victor.stinner at gmail.com>
committer: GitHub <noreply at github.com>
date: 2017-09-02T00:25:39+02:00
summary:

bpo-31250, test_asyncio: fix EventLoopTestsMixin.tearDown() (#3264)

Call doCleanups() to close the loop after calling
executor.shutdown(wait=True): see TestCase.set_event_loop() of
asyncio.test_utils.

Replace also gc.collect() with support.gc_collect().

files:
M Lib/test/test_asyncio/test_events.py

diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
index 9746678607c..27781a2d91b 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -258,8 +258,8 @@ def tearDown(self):
         if not self.loop.is_closed():
             test_utils.run_briefly(self.loop)
 
-        self.loop.close()
-        gc.collect()
+        self.doCleanups()
+        support.gc_collect()
         super().tearDown()
 
     def test_run_until_complete_nesting(self):



More information about the Python-checkins mailing list