From: Andrew Svetlov Date: Wed, 16 Mar 2022 14:59:12 +0000 (+0200) Subject: Rewrite asyncio.Queue tests with IsolatedAsyncioTestCace (#31935) X-Git-Tag: v3.11.0a7~227 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e707ceb6e464b24ddc9fdbdac7bfe15f7eeb43fd;p=thirdparty%2FPython%2Fcpython.git Rewrite asyncio.Queue tests with IsolatedAsyncioTestCace (#31935) --- diff --git a/Lib/test/test_asyncio/test_queues.py b/Lib/test/test_asyncio/test_queues.py index b1a53b859c5c..55588e8b729e 100644 --- a/Lib/test/test_asyncio/test_queues.py +++ b/Lib/test/test_asyncio/test_queues.py @@ -1,118 +1,94 @@ """Tests for queues.py""" -import unittest import asyncio +import unittest from types import GenericAlias -from test.test_asyncio import utils as test_utils def tearDownModule(): asyncio.set_event_loop_policy(None) -class _QueueTestBase(test_utils.TestCase): - - def setUp(self): - super().setUp() - self.loop = self.new_test_loop() +class QueueBasicTests(unittest.IsolatedAsyncioTestCase): - -class QueueBasicTests(_QueueTestBase): - - def _test_repr_or_str(self, fn, expect_id): + async def _test_repr_or_str(self, fn, expect_id): """Test Queue's repr or str. fn is repr or str. expect_id is True if we expect the Queue's id to appear in fn(Queue()). """ - def gen(): - when = yield - self.assertAlmostEqual(0.1, when) - when = yield 0.1 - self.assertAlmostEqual(0.2, when) - yield 0.1 - - loop = self.new_test_loop(gen) - q = asyncio.Queue() self.assertTrue(fn(q).startswith('