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:
L. Kärkkäinen
2020-03-28 20:43:14 +02:00
committed by GitHub
parent 120f0262f7
commit 48800e657f
16 changed files with 28 additions and 253 deletions

View File

@@ -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