Skip to content

Commit ed3544a

Browse files
Removed async_generator test dependency. (#321)
1 parent 96de374 commit ed3544a

File tree

5 files changed

+7
-21
lines changed

5 files changed

+7
-21
lines changed

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
test_requires = crypto_requires + [
1313
"pytest",
1414
"pytest-asyncio==0.14.0",
15-
"async_generator",
1615
"async-timeout",
1716
]
1817

tests/test_core.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import async_timeout
55
import pytest
6-
from async_generator import async_generator, yield_
76

87
from asgiref.sync import async_to_sync
98
from channels_redis.core import ChannelFull, RedisChannelLayer
@@ -55,26 +54,24 @@ async def group_send_three_messages_with_delay(group_name, channel_layer, delay)
5554

5655

5756
@pytest.fixture()
58-
@async_generator
5957
async def channel_layer():
6058
"""
6159
Channel layer fixture that flushes automatically.
6260
"""
6361
channel_layer = RedisChannelLayer(
6462
hosts=TEST_HOSTS, capacity=3, channel_capacity={"tiny": 1}
6563
)
66-
await yield_(channel_layer)
64+
yield channel_layer
6765
await channel_layer.flush()
6866

6967

7068
@pytest.fixture()
71-
@async_generator
7269
async def channel_layer_multiple_hosts():
7370
"""
7471
Channel layer fixture that flushes automatically.
7572
"""
7673
channel_layer = RedisChannelLayer(hosts=MULTIPLE_TEST_HOSTS, capacity=3)
77-
await yield_(channel_layer)
74+
yield channel_layer
7875
await channel_layer.flush()
7976

8077

tests/test_pubsub.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import async_timeout
77
import pytest
8-
from async_generator import async_generator, yield_
98

109
from asgiref.sync import async_to_sync
1110
from channels_redis.pubsub import RedisPubSubChannelLayer
@@ -14,24 +13,22 @@
1413

1514

1615
@pytest.fixture()
17-
@async_generator
1816
async def channel_layer():
1917
"""
2018
Channel layer fixture that flushes automatically.
2119
"""
2220
channel_layer = RedisPubSubChannelLayer(hosts=TEST_HOSTS)
23-
await yield_(channel_layer)
21+
yield channel_layer
2422
await channel_layer.flush()
2523

2624

2725
@pytest.fixture()
28-
@async_generator
2926
async def other_channel_layer():
3027
"""
3128
Channel layer fixture that flushes automatically.
3229
"""
3330
channel_layer = RedisPubSubChannelLayer(hosts=TEST_HOSTS)
34-
await yield_(channel_layer)
31+
yield channel_layer
3532
await channel_layer.flush()
3633

3734

@@ -47,7 +44,6 @@ async def test_send_receive(channel_layer):
4744
assert message["text"] == "Ahoy-hoy!"
4845

4946

50-
@pytest.mark.asyncio
5147
def test_send_receive_sync(channel_layer, event_loop):
5248
_await = event_loop.run_until_complete
5349
channel = _await(channel_layer.new_channel())
@@ -73,7 +69,6 @@ async def test_multi_send_receive(channel_layer):
7369
assert (await channel_layer.receive(channel))["type"] == "message.3"
7470

7571

76-
@pytest.mark.asyncio
7772
def test_multi_send_receive_sync(channel_layer, event_loop):
7873
_await = event_loop.run_until_complete
7974
channel = _await(channel_layer.new_channel())

tests/test_pubsub_sentinel.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import async_timeout
55
import pytest
6-
from async_generator import async_generator, yield_
76

87
from asgiref.sync import async_to_sync
98
from channels_redis.pubsub import RedisPubSubChannelLayer
@@ -13,13 +12,12 @@
1312

1413

1514
@pytest.fixture()
16-
@async_generator
1715
async def channel_layer():
1816
"""
1917
Channel layer fixture that flushes automatically.
2018
"""
2119
channel_layer = RedisPubSubChannelLayer(hosts=TEST_HOSTS)
22-
await yield_(channel_layer)
20+
yield channel_layer
2321
await channel_layer.flush()
2422

2523

tests/test_sentinel.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import async_timeout
55
import pytest
6-
from async_generator import async_generator, yield_
76

87
from asgiref.sync import async_to_sync
98
from channels_redis.core import ChannelFull, RedisChannelLayer
@@ -56,26 +55,24 @@ async def group_send_three_messages_with_delay(group_name, channel_layer, delay)
5655

5756

5857
@pytest.fixture()
59-
@async_generator
6058
async def channel_layer():
6159
"""
6260
Channel layer fixture that flushes automatically.
6361
"""
6462
channel_layer = RedisChannelLayer(
6563
hosts=TEST_HOSTS, capacity=3, channel_capacity={"tiny": 1}
6664
)
67-
await yield_(channel_layer)
65+
yield channel_layer
6866
await channel_layer.flush()
6967

7068

7169
@pytest.fixture()
72-
@async_generator
7370
async def channel_layer_multiple_hosts():
7471
"""
7572
Channel layer fixture that flushes automatically.
7673
"""
7774
channel_layer = RedisChannelLayer(hosts=MULTIPLE_TEST_HOSTS, capacity=3)
78-
await yield_(channel_layer)
75+
yield channel_layer
7976
await channel_layer.flush()
8077

8178

0 commit comments

Comments
 (0)