Skip to content

Commit 2eda551

Browse files
committed
Added testing for Python 3.10.
This also fixes deprecation warnings in tests/test_server.py.
1 parent 02fecb6 commit 2eda551

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
- 3.7
1818
- 3.8
1919
- 3.9
20+
- '3.10'
2021

2122
steps:
2223
- uses: actions/checkout@v2
@@ -42,7 +43,7 @@ jobs:
4243
- name: Set up Python
4344
uses: actions/setup-python@v2
4445
with:
45-
python-version: 3.9
46+
python-version: '3.10'
4647
- name: Install dependencies
4748
run: |
4849
python -m pip install --upgrade pip tox

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ classifiers =
1919
Programming Language :: Python :: 3.7
2020
Programming Language :: Python :: 3.8
2121
Programming Language :: Python :: 3.9
22+
Programming Language :: Python :: 3.10
2223
Topic :: Internet :: WWW/HTTP
2324
project_urls =
2425
Documentation = https://asgi.readthedocs.io/

tests/test_server.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ async def server_auto_close(fut, timeout):
9494
"""Server run based on run_until_complete. It will block forever with handle
9595
function because it is a while True loop without break. Use this method to close
9696
server automatically."""
97-
loop = asyncio.get_event_loop()
97+
loop = asyncio.get_running_loop()
9898
task = asyncio.ensure_future(fut, loop=loop)
9999
await asyncio.sleep(timeout)
100100
task.cancel()
@@ -105,7 +105,8 @@ def test_stateless_server(server):
105105
"""Create a UDP Server can register instance based on name from message of client.
106106
Clients can communicate to other client by name through server"""
107107

108-
loop = asyncio.get_event_loop()
108+
loop = asyncio.new_event_loop()
109+
asyncio.set_event_loop(loop)
109110
server.handle = partial(server_auto_close, fut=server.handle(), timeout=1.0)
110111

111112
client1 = Client(name="client1")
@@ -132,7 +133,8 @@ async def check_client2_behavior():
132133

133134
def test_server_delete_instance(server):
134135
"""The max_applications of Server is 10. After 20 times register, application number should be 10."""
135-
loop = asyncio.get_event_loop()
136+
loop = asyncio.new_event_loop()
137+
asyncio.set_event_loop(loop)
136138
server.handle = partial(server_auto_close, fut=server.handle(), timeout=1.0)
137139

138140
client1 = Client(name="client1")

0 commit comments

Comments
 (0)