Skip to content

Commit

Permalink
Merge pull request #71 from glennyonemitsu/wrapper-update
Browse files Browse the repository at this point in the history
unit test added for task decorator attributes preservation
  • Loading branch information
xethorn committed Oct 20, 2015
2 parents eca2f76 + 5e99c20 commit c308321
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_task.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import absolute_import
import functools
try:
from unittest.mock import MagicMock
except:
Expand Down Expand Up @@ -132,6 +133,21 @@ def test(user):
call(dict(user='something'))


def test_task_decorator_attributes():
"""Test that the decorated task has attributes similar to the original
function.
"""

decorator = task.decorate()

def test():
pass

test_task = decorator(test)
for attr_name in functools.WRAPPER_ASSIGNMENTS:
assert getattr(test_task, attr_name) == getattr(test, attr_name)


def test_task_decorator_with_heartbeat():
"""Test the task decorator with heartbeat.
"""
Expand Down

0 comments on commit c308321

Please sign in to comment.