Skip to content

Commit

Permalink
Resolve issue with Redis integration test in Python3
Browse files Browse the repository at this point in the history
  • Loading branch information
georgepsarakis authored and Omer Katz committed Apr 9, 2017
1 parent 8c4e6dd commit 9a5c53b
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions t/integration/test_canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def test_complex_chain(self, manager):

@flaky
def test_group_chord_group_chain(self, manager):
from celery.five import bytes_if_py2

if not manager.app.conf.result_backend.startswith('redis'):
raise pytest.skip('Requires redis result backend.')
redis_connection = StrictRedis()
Expand All @@ -40,11 +42,17 @@ def test_group_chord_group_chain(self, manager):

result = (before | connect | after).delay()
result.get(timeout=TIMEOUT)
redis_messages = redis_connection.lrange('redis-echo', 0, -1)
assert set(['before 0', 'before 1', 'before 2']) == \
set(redis_messages[:3])
assert redis_messages[3] == 'connect'
assert set(redis_messages[4:]) == set(['after 0', 'after 1'])
redis_messages = list(map(
bytes_if_py2,
redis_connection.lrange('redis-echo', 0, -1)
))
before_items = \
set(map(bytes_if_py2, (b'before 0', b'before 1', b'before 2')))
after_items = set(map(bytes_if_py2, (b'after 0', b'after 1')))

assert set(redis_messages[:3]) == before_items
assert redis_messages[3] == b'connect'
assert set(redis_messages[4:]) == after_items
redis_connection.delete('redis-echo')

@flaky
Expand Down

0 comments on commit 9a5c53b

Please sign in to comment.