From 09fe550ecc392927133e3f91856c630d1310ccdb Mon Sep 17 00:00:00 2001 From: Kumar Aditya Date: Sun, 9 Feb 2025 17:35:39 +0530 Subject: gh-129874: improve asyncio tests to use correct internal functions (#129887) --- Lib/test/test_asyncio/test_graph.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Lib/test/test_asyncio/test_graph.py') diff --git a/Lib/test/test_asyncio/test_graph.py b/Lib/test/test_asyncio/test_graph.py index fd2160d4ca3..62f6593c31d 100644 --- a/Lib/test/test_asyncio/test_graph.py +++ b/Lib/test/test_asyncio/test_graph.py @@ -369,6 +369,8 @@ class TestCallStackC(CallStackTestBase, unittest.IsolatedAsyncioTestCase): futures.future_discard_from_awaited_by = futures._c_future_discard_from_awaited_by asyncio.future_discard_from_awaited_by = futures.future_discard_from_awaited_by + self._current_task = asyncio.current_task + asyncio.current_task = asyncio.tasks.current_task = tasks._c_current_task def tearDown(self): futures = asyncio.futures @@ -390,6 +392,8 @@ class TestCallStackC(CallStackTestBase, unittest.IsolatedAsyncioTestCase): futures.Future = self._Future del self._Future + asyncio.current_task = asyncio.tasks.current_task = self._current_task + @unittest.skipIf( not hasattr(asyncio.futures, "_py_future_add_to_awaited_by"), @@ -414,6 +418,9 @@ class TestCallStackPy(CallStackTestBase, unittest.IsolatedAsyncioTestCase): futures.future_discard_from_awaited_by = futures._py_future_discard_from_awaited_by asyncio.future_discard_from_awaited_by = futures.future_discard_from_awaited_by + self._current_task = asyncio.current_task + asyncio.current_task = asyncio.tasks.current_task = tasks._py_current_task + def tearDown(self): futures = asyncio.futures @@ -434,3 +441,5 @@ class TestCallStackPy(CallStackTestBase, unittest.IsolatedAsyncioTestCase): asyncio.Future = self._Future futures.Future = self._Future del self._Future + + asyncio.current_task = asyncio.tasks.current_task = self._current_task -- cgit v1.2.3