Fix tests with unicode and isolation

This commit is contained in:
Andrew Godwin 2015-11-07 04:45:10 -08:00
parent b928846391
commit dae0b257d6
4 changed files with 14 additions and 5 deletions

View File

@ -168,3 +168,6 @@ class DatabaseChannelBackend(BaseChannelBackend):
def __str__(self):
return "%s(alias=%s)" % (self.__class__.__name__, self.connection.alias)
def flush(self):
pass

View File

@ -92,3 +92,9 @@ class InMemoryChannelBackend(BaseChannelBackend):
Unlocks the named channel. Always succeeds.
"""
locks.discard(channel)
def flush(self):
global queues, groups, locks
queues = {}
groups = {}
locks = set()

View File

@ -61,11 +61,6 @@ class RedisChannelBackend(BaseChannelBackend):
host, port = self.hosts[index]
return redis.Redis(host=host, port=port)
@property
def connections(self):
for i in range(len(self.hosts)):
return self.connection(i)
def send(self, channel, message):
# if channel is no str (=> bytes) convert it
if not isinstance(channel, str):
@ -189,3 +184,7 @@ class RedisChannelBackend(BaseChannelBackend):
def __str__(self):
return "%s(hosts=%s)" % (self.__class__.__name__, self.hosts)
def flush(self):
for i in range(self.ring_size):
self.connection(i).flushdb()

View File

@ -13,6 +13,7 @@ class MemoryBackendTests(TestCase):
def setUp(self):
self.backend = self.backend_class(routing={})
self.backend.flush()
def test_send_recv(self):
"""