Skip to content

Commit 1e1bbfe

Browse files
committed
Removed debugging code
1 parent bd942ee commit 1e1bbfe

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed

tests/test_anyio/mocks.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,14 @@ def tick(self):
4545
async def receive(self, max_bytes: int = 65536) -> bytes:
4646
self.tick()
4747
data = await super().receive(5)
48-
# print(f"receive() returned {data!r}")
4948
return data
5049

5150
async def receive_exactly(self, nbytes: int) -> bytes:
52-
# print(f"receive_exactly({nbytes}) called")
5351
self.tick()
5452
data = await super().receive_exactly(nbytes)
55-
# print(f" returned {data!r}")
5653
return data
5754

5855
async def receive_until(self, delimiter: bytes, max_bytes: int) -> bytes:
59-
# print(f"receive_until({delimiter!r}) called")
6056
self.tick()
6157
data = await super().receive_until(delimiter, max_bytes)
62-
# print(f" returned {data!r}")
6358
return data

tests/test_anyio/test_pubsub.py

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

33
import functools
44
import socket
5+
from contextlib import asynccontextmanager
56
from typing import Optional
67
from unittest import mock
78
from unittest.mock import patch
@@ -18,7 +19,6 @@
1819
from redis.typing import EncodableT
1920
from redis.utils import HIREDIS_AVAILABLE
2021
from tests.conftest import get_protocol_version, skip_if_server_version_lt
21-
from tests.test_asyncio.conftest import asynccontextmanager
2222

2323
pytestmark = pytest.mark.anyio
2424

@@ -401,6 +401,7 @@ async def test_channel_sync_async_message_handler(self, r):
401401
p = r.pubsub(ignore_subscribe_messages=True)
402402
await p.subscribe(foo=self.message_handler)
403403
await p.subscribe(bar=self.async_message_handler)
404+
assert await wait_for_message(p) is None
404405
assert await r.publish("foo", "test message") == 1
405406
assert await r.publish("bar", "test message 2") == 1
406407
assert await wait_for_message(p) is None
@@ -910,7 +911,6 @@ async def test_reconnect_socket_error(self, r: redis.Redis, method):
910911
# it is in a disconnected state
911912

912913
# wait for reconnect
913-
print("wait for reconnect")
914914
await wait_for_condition(
915915
self.cond, lambda: self.pubsub.connection.is_connected
916916
)
@@ -948,22 +948,14 @@ async def loop(
948948
try:
949949
if self.state == 4:
950950
break
951-
print("loop: getting message")
952951
got_msg = await self.get_message()
953-
print(f"{got_msg=} {self.state=}")
954952
assert got_msg
955953
if self.state in (1, 2):
956-
print("reconnected!")
957954
self.state = 3 # successful reconnect
958955
except redis.ConnectionError:
959956
assert self.state in (1, 2)
960-
print("noticed disconnect")
961957
self.state = 2 # signal that we noticed the disconnect
962-
except BaseException as exc:
963-
print("error while while getting message in loop():", type(exc))
964-
raise
965958
finally:
966-
print("notifying condition")
967959
self.cond.notify()
968960
# make sure that we did notice the connection error
969961
# or reconnected without any error
@@ -972,13 +964,9 @@ async def loop(
972964

973965
async def loop_step_get_message(self, send: MemoryObjectSendStream) -> bool:
974966
# get a single message via get_message
975-
print("getting message")
976967
message = await self.pubsub.get_message(timeout=0.1)
977-
print(f" result: {message} {self.state=}")
978968
if message is not None:
979-
print(" sending message")
980969
await send.send(message)
981-
print(" sent message")
982970
return True
983971
return False
984972

0 commit comments

Comments
 (0)