Skip to content

Commit

Permalink
Made it possible to apply and join to empty TaskTree
Browse files Browse the repository at this point in the history
Thanks satels for the report
  • Loading branch information
Roman Imankulov committed Sep 28, 2011
1 parent a2f9831 commit dc679a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion celery_tasktree.py
Expand Up @@ -61,7 +61,10 @@ def apply_and_join(self):
def join_tree(async_result):
""" Join to all async results in the tree """
output = []
first_result = async_result.join()[0]
results = async_result.join()
if not results:
return output
first_result = results[0]
while True:
output.append(first_result)
if not getattr(first_result, 'async_result', None):
Expand Down
5 changes: 5 additions & 0 deletions tests.py
Expand Up @@ -103,3 +103,8 @@ def test_push_and_pop():
tree.push(mkdir, args=('d0/1',))
tree.push(mkdir, args=('d0/1/2',))
[res0, res1, res2] = tree.apply_and_join()

def test_empty_task_tree():
tree = TaskTree()
results = tree.apply_and_join()
eq_(results, [])

0 comments on commit dc679a0

Please sign in to comment.