Skip to content

Commit

Permalink
Added testing for Python 3.10.
Browse files Browse the repository at this point in the history
This also fixes deprecation warnings in tests/test_server.py.
  • Loading branch information
felixxm committed Jan 14, 2022
1 parent 02fecb6 commit 2eda551
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Expand Up @@ -17,6 +17,7 @@ jobs:
- 3.7
- 3.8
- 3.9
- '3.10'

steps:
- uses: actions/checkout@v2
Expand All @@ -42,7 +43,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip tox
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Expand Up @@ -19,6 +19,7 @@ classifiers =
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Topic :: Internet :: WWW/HTTP
project_urls =
Documentation = https://asgi.readthedocs.io/
Expand Down
8 changes: 5 additions & 3 deletions tests/test_server.py
Expand Up @@ -94,7 +94,7 @@ async def server_auto_close(fut, timeout):
"""Server run based on run_until_complete. It will block forever with handle
function because it is a while True loop without break. Use this method to close
server automatically."""
loop = asyncio.get_event_loop()
loop = asyncio.get_running_loop()
task = asyncio.ensure_future(fut, loop=loop)
await asyncio.sleep(timeout)
task.cancel()
Expand All @@ -105,7 +105,8 @@ def test_stateless_server(server):
"""Create a UDP Server can register instance based on name from message of client.
Clients can communicate to other client by name through server"""

loop = asyncio.get_event_loop()
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
server.handle = partial(server_auto_close, fut=server.handle(), timeout=1.0)

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

def test_server_delete_instance(server):
"""The max_applications of Server is 10. After 20 times register, application number should be 10."""
loop = asyncio.get_event_loop()
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
server.handle = partial(server_auto_close, fut=server.handle(), timeout=1.0)

client1 = Client(name="client1")
Expand Down

0 comments on commit 2eda551

Please sign in to comment.