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)
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)
def test_get_hosts_excludes_cli_exclude_hosts_from_decorator_hosts(): assert 'foo' not in get_hosts(hosts('foo', 'bar')(dummy), [], [], ['foo'])
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'])
def test_get_hosts_excludes_cli_exclude_hosts_from_decorator_hosts(): assert "foo" not in get_hosts(hosts("foo", "bar")(dummy), [], [], ["foo"])