Skip to content

Commit bca7a31

Browse files
committed
Fixed tests
1 parent be5d2e8 commit bca7a31

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

redis/event.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def __init__(
9696
}
9797

9898
self._lock = threading.Lock()
99-
self._async_lock = asyncio.Lock()
99+
self._async_lock = None
100100

101101
if event_listeners:
102102
self.register_listeners(event_listeners)
@@ -109,6 +109,9 @@ def dispatch(self, event: object):
109109
listener.listen(event)
110110

111111
async def dispatch_async(self, event: object):
112+
if self._async_lock is None:
113+
self._async_lock = asyncio.Lock()
114+
112115
async with self._async_lock:
113116
listeners = self._event_listeners_mapping.get(type(event), [])
114117

tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ def cluster_tests(c, uvloop=False, protocol=2, profile=False):
7474
cluster_tls_url = "rediss://localhost:27379/0"
7575
if uvloop:
7676
run(
77-
f"pytest {profile_arg} --protocol={protocol} --ignore=tests/test_scenario --cov=./ --cov-report=xml:coverage_cluster_resp{protocol}_uvloop.xml -m 'not onlynoncluster and not redismod' --redis-url={cluster_url} --redis-ssl-url={cluster_tls_url} --junit-xml=cluster-resp{protocol}-uvloop-results.xml --uvloop"
77+
f"pytest {profile_arg} --protocol={protocol} --ignore=tests/test_scenario --ignore=tests/test_asyncio/test_scenario --cov=./ --cov-report=xml:coverage_cluster_resp{protocol}_uvloop.xml -m 'not onlynoncluster and not redismod' --redis-url={cluster_url} --redis-ssl-url={cluster_tls_url} --junit-xml=cluster-resp{protocol}-uvloop-results.xml --uvloop"
7878
)
7979
else:
8080
run(
81-
f"pytest {profile_arg} --protocol={protocol} --ignore=tests/test_scenario --cov=./ --cov-report=xml:coverage_cluster_resp{protocol}.xml -m 'not onlynoncluster and not redismod' --redis-url={cluster_url} --redis-ssl-url={cluster_tls_url} --junit-xml=cluster-resp{protocol}-results.xml"
81+
f"pytest {profile_arg} --protocol={protocol} --ignore=tests/test_scenario --ignore=tests/test_asyncio/test_scenario --cov=./ --cov-report=xml:coverage_cluster_resp{protocol}.xml -m 'not onlynoncluster and not redismod' --redis-url={cluster_url} --redis-ssl-url={cluster_tls_url} --junit-xml=cluster-resp{protocol}-results.xml"
8282
)
8383

8484

tests/test_maint_notifications_handling.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ def setsockopt(self, level, optname, value):
330330
"""Simulate setting socket options."""
331331
pass
332332

333+
def setblocking(self, blocking):
334+
pass
335+
333336
def getpeername(self):
334337
"""Simulate getting peer name."""
335338
return self.address

0 commit comments

Comments
 (0)