mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-129874: improve asyncio tests to use correct internal functions (#129887)
This commit is contained in:
parent
c88dacb391
commit
09fe550ecc
3 changed files with 110 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue