-
Notifications
You must be signed in to change notification settings - Fork 384
Open
Description
The @task decorator doesn't appear to play nicely with other decorators, unlike Fabric. I may not have read this part of the documentation yet, but I wouldn't expect @task to undermine python norms.
For example:
def capture_error(fn):
@wraps(fn)
def wrapper(*args, **kwargs):
try:
return fn(*args, **kwargs)
except AssertionError as err:
print(err)
return wrapper
@task
@capture_error
def foo(c):
print('bar')
raise AssertionError('baz')this looks fine:
inv foo
>>> bar
>>> baz
but when I add a parameter:
@task
@capture_error
def foo(c, p1):
print(p1)
raise AssertionError('baz')I get:
inv foo bar
>>> No idea what 'bar' is!
The parameter handling docs offer no insight into what the problem is.