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 = [
37
37
" coverage>=7.6.2" ,
38
38
" pre-commit>=4.0.1" ,
39
39
" pytest>=8.3.3" ,
40
- " pytest-asyncio>=0.24 .0" ,
40
+ " pytest-asyncio>=1.1 .0" ,
41
41
" ruff>=0.6.9" ,
42
42
" tox>=4.21.2" ,
43
43
]
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):
61
61
assert message ["text" ] == "Ahoy-hoy!"
62
62
63
63
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
66
66
channel = _await (channel_layer .new_channel ())
67
67
async_to_sync (channel_layer .send , force_new_loop = True )(
68
68
channel , {"type" : "test.message" , "text" : "Ahoy-hoy!" }
@@ -86,8 +86,8 @@ async def test_multi_send_receive(channel_layer):
86
86
assert (await channel_layer .receive (channel ))["type" ] == "message.3"
87
87
88
88
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
91
91
channel = _await (channel_layer .new_channel ())
92
92
send = async_to_sync (channel_layer .send )
93
93
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):
42
42
assert message ["text" ] == "Ahoy-hoy!"
43
43
44
44
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
47
47
channel = _await (channel_layer .new_channel ())
48
48
async_to_sync (channel_layer .send , force_new_loop = True )(
49
49
channel , {"type" : "test.message" , "text" : "Ahoy-hoy!" }
@@ -67,8 +67,8 @@ async def test_multi_send_receive(channel_layer):
67
67
assert (await channel_layer .receive (channel ))["type" ] == "message.3"
68
68
69
69
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
72
72
channel = _await (channel_layer .new_channel ())
73
73
send = async_to_sync (channel_layer .send )
74
74
send (channel , {"type" : "message.1" })
You can’t perform that action at this time.
0 commit comments