aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_asyncio/test_graph.py
diff options
context:
space:
mode:
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