[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fab-user] @needs_host decorator trashes function signature on func
From: |
Matthew Wilson |
Subject: |
Re: [Fab-user] @needs_host decorator trashes function signature on functions it decorates |
Date: |
Wed, 9 Sep 2009 21:22:24 -0400 |
Well, I'm having trouble with github tonight, but the patch below
fixes needs_host. I also attached the patch separately. You'll be
amazed at how much work went into this :)
diff --git a/fabric/network.py b/fabric/network.py
index c9e6739..da9e8a3 100644
--- a/fabric/network.py
+++ b/fabric/network.py
@@ -11,6 +11,8 @@ import sys
from fabric.utils import abort
+from decorator import decorator
+
try:
import warnings
warnings.simplefilter('ignore', DeprecationWarning)
@@ -361,6 +363,7 @@ def output_thread(prefix, chan, stderr=False, capture=None):
return thread
address@hidden
def needs_host(func):
"""
Prompt user for value of ``env.host_string`` when ``env.host_string`` is
diff --git a/setup.py b/setup.py
index d334e76..c6623f5 100644
--- a/setup.py
+++ b/setup.py
@@ -15,7 +15,7 @@ For more information, please see the Fabric website
or execute ``fab --help``.
author='Jeff Forcier',
author_email='address@hidden',
url='http://fabfile.org',
- install_requires=['paramiko >=1.7, <2.0'],
+ install_requires=['paramiko >=1.7, <2.0', 'decorator'],
packages=find_packages(),
entry_points={
'console_scripts': [
diff --git a/tests/test_operations.py b/tests/test_operations.py
index 5575c4e..d86933f 100644
--- a/tests/test_operations.py
+++ b/tests/test_operations.py
@@ -1,11 +1,11 @@
from __future__ import with_statement
-import sys
+import inspect, sys
from nose.tools import raises, eq_
from fudge import with_patched_object
-from fabric.operations import require, prompt
+from fabric.operations import require, prompt, get
from utils import mock_streams
@@ -96,3 +96,14 @@ def test_prompt_with_default():
d = "default!"
prompt(s, default=d)
eq_(sys.stdout.getvalue(), "%s [%s] " % (s, d))
+
+
+def test_get_has_good_signature():
+
+ """
+ Verify the signature for get is NOT *args, **kwargs.
+ """
+
+ sig = inspect.getargspec(get)
+
+ assert sig[0] == ['remote_path', 'local_path'], sig
--
W. Matthew Wilson
address@hidden
http://tplus1.com
mychange.diff
Description: Text Data