Skip to content

Commit 1823bd7

Browse files
committed
Adding aioredis tests.
1 parent 6cf5def commit 1823bd7

File tree

1 file changed

+27
-21
lines changed

1 file changed

+27
-21
lines changed

tests/integration/instruments/test_aioredis_py36plus.py

+27-21
Original file line numberDiff line numberDiff line change
@@ -144,31 +144,37 @@ async def test_echo(tracked_request):
144144
assert tracked_request.complete_spans[0].operation == "Redis/ECHO"
145145

146146

147-
# def test_pipeline_echo(redis_conn, tracked_request):
148-
# with redis_conn.pipeline() as p:
149-
# p.echo("Hello World!")
150-
# p.execute()
147+
@async_test
148+
async def test_pipeline_echo(tracked_request):
149+
redis_conn = await get_redis_conn()
150+
with redis_conn.pipeline() as p:
151+
p.echo("Hello World!")
152+
p.execute()
151153

152-
# assert len(tracked_request.complete_spans) == 1
153-
# assert tracked_request.complete_spans[0].operation == "Redis/MULTI"
154+
assert len(tracked_request.complete_spans) == 1
155+
assert tracked_request.complete_spans[0].operation == "Redis/MULTI"
154156

155157

156-
# def test_execute_command_missing_argument(redis_conn, tracked_request):
157-
# # Redis instrumentation doesn't crash if op is missing.
158-
# # This raises a TypeError (Python 3) or IndexError (Python 2)
159-
# # when calling the original method.
160-
# with pytest.raises(IndexError):
161-
# redis_conn.execute_command()
158+
@async_test
159+
async def test_execute_command_missing_argument(tracked_request):
160+
redis_conn = await get_redis_conn()
161+
# Redis instrumentation doesn't crash if op is missing.
162+
# This raises a TypeError (Python 3) or IndexError (Python 2)
163+
# when calling the original method.
164+
with pytest.raises(IndexError):
165+
redis_conn.execute_command()
162166

163-
# assert len(tracked_request.complete_spans) == 1
164-
# assert tracked_request.complete_spans[0].operation == "Redis/Unknown"
167+
assert len(tracked_request.complete_spans) == 1
168+
assert tracked_request.complete_spans[0].operation == "Redis/Unknown"
165169

166170

167-
# def test_perform_request_bad_url(redis_conn, tracked_request):
168-
# with pytest.raises(TypeError):
169-
# # Redis instrumentation doesn't crash if op has the wrong type.
170-
# # This raises a TypeError when calling the original method.
171-
# redis_conn.execute_command(None)
171+
@async_test
172+
async def test_perform_request_bad_url(tracked_request):
173+
redis_conn = await get_redis_conn()
174+
with pytest.raises(TypeError):
175+
# Redis instrumentation doesn't crash if op has the wrong type.
176+
# This raises a TypeError when calling the original method.
177+
redis_conn.execute_command(None)
172178

173-
# assert len(tracked_request.complete_spans) == 1
174-
# assert tracked_request.complete_spans[0].operation == "Redis/None"
179+
assert len(tracked_request.complete_spans) == 1
180+
assert tracked_request.complete_spans[0].operation == "Redis/None"

0 commit comments

Comments
 (0)