summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2018-01-24 16:31:01 (GMT)
committerGitHub <noreply@github.com>2018-01-24 16:31:01 (GMT)
commit22feeb88b473b288950cdb2f6c5d28692274b5f9 (patch)
tree805ea2b2b684bb331f1205f1347b5b60e1dfd2db /Lib/test/test_asyncio
parent8ded5b803705328749622256701b3f08a9d6c5ab (diff)
downloadcpython-22feeb88b473b288950cdb2f6c5d28692274b5f9.zip
cpython-22feeb88b473b288950cdb2f6c5d28692274b5f9.tar.gz
cpython-22feeb88b473b288950cdb2f6c5d28692274b5f9.tar.bz2
bpo-32643: Drop support for a few private Task and Future APIs. (#5293)
Specifically, it's not possible to subclass Task/Future classes and override the following methods: * Future._schedule_callbacks * Task._step * Task._wakeup
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r--Lib/test/test_asyncio/test_futures.py4
-rw-r--r--Lib/test/test_asyncio/test_tasks.py28
2 files changed, 3 insertions, 29 deletions
diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py
index 37f4c65..8c837ad 100644
--- a/Lib/test/test_asyncio/test_futures.py
+++ b/Lib/test/test_asyncio/test_futures.py
@@ -176,10 +176,6 @@ class BaseFutureTests:
fut.remove_done_callback(lambda f: None)
fut = self.cls.__new__(self.cls, loop=self.loop)
- with self.assertRaises((RuntimeError, AttributeError)):
- fut._schedule_callbacks()
-
- fut = self.cls.__new__(self.cls, loop=self.loop)
try:
repr(fut)
except (RuntimeError, AttributeError):
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py
index 1c361c8..daa1ff9 100644
--- a/Lib/test/test_asyncio/test_tasks.py
+++ b/Lib/test/test_asyncio/test_tasks.py
@@ -1401,17 +1401,6 @@ class BaseTaskTests:
self.assertTrue(t.done())
self.assertIsNone(t.result())
- def test_step_with_baseexception(self):
- @asyncio.coroutine
- def notmutch():
- raise BaseException()
-
- task = self.new_task(self.loop, notmutch())
- self.assertRaises(BaseException, task._step)
-
- self.assertTrue(task.done())
- self.assertIsInstance(task.exception(), BaseException)
-
def test_baseexception_during_cancel(self):
def gen():
@@ -2275,22 +2264,12 @@ def add_subclass_tests(cls):
self.calls = collections.defaultdict(lambda: 0)
super().__init__(*args, **kwargs)
- def _schedule_callbacks(self):
- self.calls['_schedule_callbacks'] += 1
- return super()._schedule_callbacks()
-
def add_done_callback(self, *args, **kwargs):
self.calls['add_done_callback'] += 1
return super().add_done_callback(*args, **kwargs)
class Task(CommonFuture, BaseTask):
- def _step(self, *args):
- self.calls['_step'] += 1
- return super()._step(*args)
-
- def _wakeup(self, *args):
- self.calls['_wakeup'] += 1
- return super()._wakeup(*args)
+ pass
class Future(CommonFuture, BaseFuture):
pass
@@ -2310,12 +2289,11 @@ def add_subclass_tests(cls):
self.assertEqual(
dict(task.calls),
- {'_step': 2, '_wakeup': 1, 'add_done_callback': 1,
- '_schedule_callbacks': 1})
+ {'add_done_callback': 1})
self.assertEqual(
dict(fut.calls),
- {'add_done_callback': 1, '_schedule_callbacks': 1})
+ {'add_done_callback': 1})
# Add patched Task & Future back to the test case
cls.Task = Task