def test_hosts_decorator_overrides_env_hosts_with_task_decorator_last(): @hosts('bar') @task def command(): pass eq_hosts(command, ['bar']) assert 'foo' not in get_hosts(command, [], [])
def test_hosts_decorator_overrides_env_hosts(): """ If @hosts is used it replaces any env.hosts value """ @hosts('bar') def command(): pass eq_hosts(command, ['bar']) assert 'foo' not in get_hosts(command, [], [])
def test_hosts_decorator_overrides_env_hosts_with_task_decorator_first(): """ If @hosts is used it replaces any env.hosts value even with @task """ @task @hosts('bar') def command(): pass eq_hosts(command, ['bar']) assert 'foo' not in get_hosts(command, [], [])
def test_hosts_decorator_overrides_env_hosts(): """ If @hosts is used it replaces any env.hosts value """ @hosts("bar") def command(): pass eq_hosts(command, ["bar"]) assert "foo" not in get_hosts(command, [], [])
def eq_hosts(command, host_list): eq_(set(get_hosts(command, [], [])), set(host_list))
def test_get_hosts_excludes_global_exclude_hosts_from_global_hosts(): assert 'foo' not in get_hosts(dummy, [], [], [])
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_cli_hosts(): assert 'foo' not in get_hosts(dummy, ['foo', 'bar'], [], ['foo'])