Ejemplo n.º 1
0
def test_decorator_incompatibility_on_task():
    from fabric.decorators import task, hosts, runs_once, roles
    def foo(): return "foo"
    foo = task(foo)

    # since we aren't setting foo to be the newly decorated thing, its cool
    hosts('me@localhost')(foo)
    runs_once(foo)
    roles('www')(foo)
Ejemplo n.º 2
0
def test_decorator_incompatibility_on_task():
    from fabric.decorators import task, hosts, runs_once, roles

    def foo():
        return "foo"

    foo = task(foo)

    # since we aren't setting foo to be the newly decorated thing, its cool
    hosts('me@localhost')(foo)
    runs_once(foo)
    roles('www')(foo)
Ejemplo n.º 3
0
def test_decorator_closure_hiding():
    from fabric.decorators import task, hosts
    def foo(): print env.host_string
    foo = hosts("me@localhost")(foo)
    foo = task(foo)

    # this broke in the old way, due to closure stuff hiding in the
    # function, but task making an object
    eq_(["me@localhost"], foo.hosts)
Ejemplo n.º 4
0
def test_decorator_closure_hiding():
    from fabric.decorators import task, hosts

    def foo():
        print env.host_string

    foo = hosts("me@localhost")(foo)
    foo = task(foo)

    # this broke in the old way, due to closure stuff hiding in the
    # function, but task making an object
    eq_(["me@localhost"], foo.hosts)
Ejemplo n.º 5
0
def test_get_hosts_excludes_cli_exclude_hosts_from_decorator_hosts():
    assert 'foo' not in get_hosts(hosts('foo', 'bar')(dummy), [], [], ['foo'])
Ejemplo n.º 6
0
def test_get_hosts_excludes_cli_exclude_hosts_from_decorator_hosts():
    def dummy():
        pass

    assert 'foo' not in get_hosts(hosts('foo', 'bar')(dummy), [], [], ['foo'])
Ejemplo n.º 7
0
def test_get_hosts_excludes_cli_exclude_hosts_from_decorator_hosts():
    assert "foo" not in get_hosts(hosts("foo", "bar")(dummy), [], [], ["foo"])