Skip to content

Commit 8d2f11e

Browse files
committed
Drop the _PyFuture/Task vs. _CFuture/Task tests
we don't want to test asyncio itself the tests run into depreciation warnings on Python 3.7
1 parent 08423b0 commit 8d2f11e

2 files changed

Lines changed: 6 additions & 44 deletions

File tree

tests/python/__init__.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ def load_tests(*args):
99
return load_package_tests(os.path.dirname(__file__), *args)
1010

1111

12-
import asyncio.tasks
13-
asyncio.tasks.Task = asyncio.tasks._PyTask
14-
import asyncio.futures
15-
asyncio.futures.Future = asyncio.futures._PyFuture
16-
#
17-
#
1812
# this code is from
1913
# git@github.com:python/cpython.git
2014
# Revision d48ecebad

tests/python/test_tasks.py

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ class BaseTaskTests:
8080
Future = None
8181

8282
def new_task(self, loop, coro):
83-
return self.__class__.Task(coro, loop=loop)
83+
return asyncio.Task(coro, loop=loop)
8484

8585
def new_future(self, loop):
86-
return self.__class__.Future(loop=loop)
86+
return asyncio.Future(loop=loop)
8787

8888
def setUp(self):
8989
super().setUp()
@@ -1449,8 +1449,6 @@ def coro():
14491449
self.assertIsNone(t2.result())
14501450

14511451
def test_current_task(self):
1452-
Task = self.__class__.Task
1453-
14541452
self.assertIsNone(asyncio.current_task(loop=self.loop))
14551453

14561454
@asyncio.coroutine
@@ -1470,8 +1468,6 @@ def coro(loop):
14701468
self.assertIsNone(asyncio.current_task(loop=self.loop))
14711469

14721470
def test_current_task_with_interleaving_tasks(self):
1473-
Task = self.__class__.Task
1474-
14751471
self.assertIsNone(asyncio.current_task(loop=self.loop))
14761472

14771473
fut1 = self.new_future(self.loop)
@@ -1797,7 +1793,6 @@ def foo():
17971793

17981794
@unittest.skipUnless(PY34, 'need python 3.4 or later')
17991795
def test_log_destroyed_pending_task(self):
1800-
Task = self.__class__.Task
18011796

18021797
@asyncio.coroutine
18031798
def kill_me(loop):
@@ -2113,40 +2108,13 @@ async def func():
21132108
return cls
21142109

21152110

2116-
@unittest.skipUnless(hasattr(futures, '_CFuture'), 'requires the C _asyncio module')
2117-
class CTask_CFuture_Tests(BaseTaskTests, test_utils.TestCase):
2118-
Task = getattr(tasks, '_CTask', None)
2119-
Future = getattr(futures, '_CFuture', None)
2120-
2121-
2122-
@unittest.skipUnless(hasattr(futures, '_CFuture'), 'requires the C _asyncio module')
2123-
@add_subclass_tests
2124-
class CTask_CFuture_SubclassTests(BaseTaskTests, test_utils.TestCase):
2125-
Task = getattr(tasks, '_CTask', None)
2126-
Future = getattr(futures, '_CFuture', None)
2127-
2128-
2129-
@unittest.skipUnless(hasattr(futures, '_CFuture'), 'requires the C _asyncio module')
2130-
class CTask_PyFuture_Tests(BaseTaskTests, test_utils.TestCase):
2131-
Task = getattr(tasks, '_CTask', None)
2132-
Future = futures._PyFuture
2133-
2134-
2135-
@unittest.skipUnless(hasattr(futures, '_CFuture'), 'requires the C _asyncio module')
2136-
class PyTask_CFuture_Tests(BaseTaskTests, test_utils.TestCase):
2137-
Task = tasks._PyTask
2138-
Future = getattr(futures, '_CFuture', None)
2139-
2140-
2141-
class PyTask_PyFuture_Tests(BaseTaskTests, test_utils.TestCase):
2142-
Task = tasks._PyTask
2143-
Future = futures._PyFuture
2111+
class TaskTests(BaseTaskTests, test_utils.TestCase):
2112+
pass
21442113

21452114

21462115
@add_subclass_tests
2147-
class PyTask_PyFuture_SubclassTests(BaseTaskTests, test_utils.TestCase):
2148-
Task = tasks._PyTask
2149-
Future = futures._PyFuture
2116+
class TaskSubclassTests(BaseTaskTests, test_utils.TestCase):
2117+
pass
21502118

21512119

21522120
class GenericTaskTests(test_utils.TestCase):

0 commit comments

Comments
 (0)