Deprecation and test cleanup (#1818)
* Remove remove_route, deprecated in 19.6. * No need for py35 compat anymore. * Rewrite asyncio.coroutines with async/await. * Remove deprecated request.raw_args. * response.text() takes str only: avoid deprecation warning in all but one test. * Remove unused import. * Revert unnecessary deprecation warning. * Remove apparently unnecessary py38 compat. * Avoid asyncio.Task.all_tasks deprecation warning. * Avoid warning on a test that tests deprecated response.text(int). * Add pytest-asyncio to tox deps. * Run the coroutine returned by AsyncioServer.close. Co-authored-by: L. Kärkkäinen <tronic@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import asyncio
|
||||
import sys
|
||||
|
||||
from collections import deque, namedtuple
|
||||
|
||||
@@ -81,7 +82,12 @@ def test_listeners_triggered(app):
|
||||
with pytest.warns(UserWarning):
|
||||
server.run()
|
||||
|
||||
for task in asyncio.Task.all_tasks():
|
||||
all_tasks = (
|
||||
asyncio.Task.all_tasks()
|
||||
if sys.version_info < (3, 7) else
|
||||
asyncio.all_tasks(asyncio.get_event_loop())
|
||||
)
|
||||
for task in all_tasks:
|
||||
task.cancel()
|
||||
|
||||
assert before_server_start
|
||||
@@ -126,7 +132,12 @@ def test_listeners_triggered_async(app):
|
||||
with pytest.warns(UserWarning):
|
||||
server.run()
|
||||
|
||||
for task in asyncio.Task.all_tasks():
|
||||
all_tasks = (
|
||||
asyncio.Task.all_tasks()
|
||||
if sys.version_info < (3, 7) else
|
||||
asyncio.all_tasks(asyncio.get_event_loop())
|
||||
)
|
||||
for task in all_tasks:
|
||||
task.cancel()
|
||||
|
||||
assert before_server_start
|
||||
|
||||
Reference in New Issue
Block a user