File tree Expand file tree Collapse file tree 4 files changed +18
-9
lines changed Expand file tree Collapse file tree 4 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ dev-dependencies = [
3737 " coverage>=7.6.2" ,
3838 " pre-commit>=4.0.1" ,
3939 " pytest>=8.3.3" ,
40- " pytest-asyncio>=0.24 .0" ,
40+ " pytest-asyncio>=1.1 .0" ,
4141 " ruff>=0.6.9" ,
4242 " tox>=4.21.2" ,
4343]
Original file line number Diff line number Diff line change 1+ import asyncio
2+ import pytest
3+
4+
5+ @pytest .fixture ()
6+ def asyncio_event_loop ():
7+ e = asyncio .new_event_loop ()
8+ yield e
9+ e .close ()
Original file line number Diff line number Diff line change @@ -61,8 +61,8 @@ async def test_send_receive(channel_layer):
6161 assert message ["text" ] == "Ahoy-hoy!"
6262
6363
64- def test_send_receive_sync (channel_layer , event_loop ):
65- _await = event_loop .run_until_complete
64+ def test_send_receive_sync (channel_layer , asyncio_event_loop ):
65+ _await = asyncio_event_loop .run_until_complete
6666 channel = _await (channel_layer .new_channel ())
6767 async_to_sync (channel_layer .send , force_new_loop = True )(
6868 channel , {"type" : "test.message" , "text" : "Ahoy-hoy!" }
@@ -86,8 +86,8 @@ async def test_multi_send_receive(channel_layer):
8686 assert (await channel_layer .receive (channel ))["type" ] == "message.3"
8787
8888
89- def test_multi_send_receive_sync (channel_layer , event_loop ):
90- _await = event_loop .run_until_complete
89+ def test_multi_send_receive_sync (channel_layer , asyncio_event_loop ):
90+ _await = asyncio_event_loop .run_until_complete
9191 channel = _await (channel_layer .new_channel ())
9292 send = async_to_sync (channel_layer .send )
9393 send (channel , {"type" : "message.1" })
Original file line number Diff line number Diff line change @@ -42,8 +42,8 @@ async def test_send_receive(channel_layer):
4242 assert message ["text" ] == "Ahoy-hoy!"
4343
4444
45- def test_send_receive_sync (channel_layer , event_loop ):
46- _await = event_loop .run_until_complete
45+ def test_send_receive_sync (channel_layer , asyncio_event_loop ):
46+ _await = asyncio_event_loop .run_until_complete
4747 channel = _await (channel_layer .new_channel ())
4848 async_to_sync (channel_layer .send , force_new_loop = True )(
4949 channel , {"type" : "test.message" , "text" : "Ahoy-hoy!" }
@@ -67,8 +67,8 @@ async def test_multi_send_receive(channel_layer):
6767 assert (await channel_layer .receive (channel ))["type" ] == "message.3"
6868
6969
70- def test_multi_send_receive_sync (channel_layer , event_loop ):
71- _await = event_loop .run_until_complete
70+ def test_multi_send_receive_sync (channel_layer , asyncio_event_loop ):
71+ _await = asyncio_event_loop .run_until_complete
7272 channel = _await (channel_layer .new_channel ())
7373 send = async_to_sync (channel_layer .send )
7474 send (channel , {"type" : "message.1" })
You can’t perform that action at this time.
0 commit comments