]> granicus.if.org Git - python/commitdiff
bpo-31250, test_asyncio: fix EventLoopTestsMixin.tearDown() (#3264)
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 1 Sep 2017 22:25:39 +0000 (00:25 +0200)
committerGitHub <noreply@github.com>
Fri, 1 Sep 2017 22:25:39 +0000 (00:25 +0200)
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().

Lib/test/test_asyncio/test_events.py

index 9746678607c936fcbbd6938b6deab853867447c3..27781a2d91b336de08a18d2d16afc8851848c741 100644 (file)
@@ -258,8 +258,8 @@ class EventLoopTestsMixin:
         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):