aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_asyncio/test_graph.py
diff options
context:
space:
mode:
authorKumar Aditya <kumaraditya@python.org>2025-02-09 17:35:39 +0530
committerGitHub <noreply@github.com>2025-02-09 12:05:39 +0000
commit09fe550ecc392927133e3f91856c630d1310ccdb (patch)
treebe3ba5f65ac6114f162fe6b656ab1df1503b6d78 /Lib/test/test_asyncio/test_graph.py
parentc88dacb391ab95229b500dabb812e02109058ed7 (diff)
downloadcpython-09fe550ecc392927133e3f91856c630d1310ccdb.tar.gz
cpython-09fe550ecc392927133e3f91856c630d1310ccdb.zip
gh-129874: improve asyncio tests to use correct internal functions (#129887)
Diffstat (limited to 'Lib/test/test_asyncio/test_graph.py')
-rw-r--r--Lib/test/test_asyncio/test_graph.py9
1 files changed, 9 insertions, 0 deletions
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