Skip to content

Instantly share code, notes, and snippets.

@tswicegood
Created July 1, 2011 01:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tswicegood/1057666 to your computer and use it in GitHub Desktop.
Save tswicegood/1057666 to your computer and use it in GitHub Desktop.
....E..
======================================================================
ERROR: test_decorators.test_passes_args_to_the_task_class
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/tswicegood/.virtualenvs/fabric/lib/python2.7/site-packages/nose/case.py", line 187, in runTest
self.test(*self.arg)
File "/Users/tswicegood/work/github/python/fabric/tests/test_decorators.py", line 81, in test_passes_args_to_the_task_class
foo = decorators.task(foo, task_class=fake, *random_vars)
TypeError: task() got multiple values for keyword argument 'task_class'
----------------------------------------------------------------------
Ran 7 tests in 0.003s
FAILED (errors=1)
diff --git a/fabric/decorators.py b/fabric/decorators.py
index 0f38860..794e5ca 100644
--- a/fabric/decorators.py
+++ b/fabric/decorators.py
@@ -10,7 +10,7 @@ from fabric import tasks
from .context_managers import settings
-def task(func, task_class=None, args=None, kwargs=None):
+def task(func, task_class=None, *args, **kwargs):
"""
Decorator declaring the wrapped function as a :ref:`new-style task <new-style-tasks>`.
@@ -24,10 +24,6 @@ def task(func, task_class=None, args=None, kwargs=None):
"""
if task_class is None:
task_class = tasks.WrappedCallableTask
- if args is None:
- args = ()
- if kwargs is None:
- kwargs = {}
return task_class(func, *args, **kwargs)
diff --git a/tests/test_decorators.py b/tests/test_decorators.py
index 4e391d8..c093794 100644
--- a/tests/test_decorators.py
+++ b/tests/test_decorators.py
@@ -78,7 +78,7 @@ def test_passes_args_to_the_task_class():
fudge.clear_calls()
fudge.clear_expectations()
- foo = decorators.task(foo, task_class=fake, args=random_vars)
+ foo = decorators.task(foo, task_class=fake, *random_vars)
fudge.verify()
@@ -94,5 +94,5 @@ def test_passes_kwargs_to_the_task_class():
fudge.clear_calls()
fudge.clear_expectations()
- foo = decorators.task(foo, task_class=fake, kwargs=random_vars)
+ foo = decorators.task(foo, task_class=fake, **random_vars)
fudge.verify()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment