[Python-checkins] bpo-42553: Fix test_asyncio.test_call_later() (GH-23627)

miss-islington webhook-mailer at python.org
Thu Dec 3 08:20:13 EST 2020


https://github.com/python/cpython/commit/9f26833cedd33439b11059d423f599982abeb180
commit: 9f26833cedd33439b11059d423f599982abeb180
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2020-12-03T05:20:07-08:00
summary:

bpo-42553: Fix test_asyncio.test_call_later() (GH-23627)


Fix test_asyncio.test_call_later() race condition: don't measure
asyncio performance in the call_later() unit test. The test failed
randomly on the CI.
(cherry picked from commit 7e5e13d113798117d5ef25c5ffdbd0eb39420f98)

Co-authored-by: Victor Stinner <vstinner at python.org>

files:
A Misc/NEWS.d/next/Tests/2020-12-03-13-32-44.bpo-42553.2TRE2N.rst
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 92b1522e956c4..fa6c49d89da5c 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -293,11 +293,8 @@ def callback(arg):
             self.loop.stop()
 
         self.loop.call_later(0.1, callback, 'hello world')
-        t0 = time.monotonic()
         self.loop.run_forever()
-        t1 = time.monotonic()
         self.assertEqual(results, ['hello world'])
-        self.assertTrue(0.08 <= t1-t0 <= 0.8, t1-t0)
 
     def test_call_soon(self):
         results = []
diff --git a/Misc/NEWS.d/next/Tests/2020-12-03-13-32-44.bpo-42553.2TRE2N.rst b/Misc/NEWS.d/next/Tests/2020-12-03-13-32-44.bpo-42553.2TRE2N.rst
new file mode 100644
index 0000000000000..872214284728b
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2020-12-03-13-32-44.bpo-42553.2TRE2N.rst
@@ -0,0 +1,3 @@
+Fix ``test_asyncio.test_call_later()`` race condition: don't measure asyncio
+performance in the ``call_later()`` unit test. The test failed randomly on
+the CI.



More information about the Python-checkins mailing list