[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: |
Jeff Forcier |
Subject: |
Re: [Fab-user] @needs_host decorator trashes function signature on functions it decorates |
Date: |
Thu, 12 Nov 2009 00:06:24 -0500 |
Hey Matt,
At long last I finally got around to clearing out my starred Fab
emails and making tickets out of them, including this one:
http://code.fabfile.org/issues/show/103
Thanks again for the pointer to this decorators module. I plan to get
this in for 0.9.1 since it will also (I think) help streamline some
other aspects of the API docs.
Best,
Jeff
On Wed, Sep 9, 2009 at 8:22 PM, Matthew Wilson <address@hidden> wrote:
> 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
>
--
Jeff Forcier
Unix sysadmin; Python/Ruby developer
http://bitprophet.org
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Fab-user] @needs_host decorator trashes function signature on functions it decorates,
Jeff Forcier <=