test/: PEP8 compliancy (#24803)

* test/: PEP8 compliancy

- Make PEP8 compliant

* Python3 chokes on casting int to bytes (#24952)

But if we tell the formatter that the var is a number, it works
This commit is contained in:
Dag Wieers
2017-05-30 19:05:19 +02:00
committed by John R Barker
parent 31c59ad5f9
commit 4efec414e7
110 changed files with 1702 additions and 1547 deletions

View File

@@ -81,6 +81,7 @@ class Role(object):
for dep in self.dependencies:
f.write('- { role: %s }\n' % dep)
class DynamicInventory(object):
BASESCRIPT = '''#!/usr/bin/python
import json
@@ -140,13 +141,12 @@ print(json.dumps(data, indent=2, sort_keys=True))
'hosts': [xhost],
}
def write_script(self):
fdir = os.path.join(TESTDIR, 'inventory')
if not os.path.isdir(fdir):
os.makedirs(fdir)
fpath = os.path.join(fdir, 'hosts')
#fpath = os.path.join(TESTDIR, 'inventory')
# fpath = os.path.join(TESTDIR, 'inventory')
self.fpath = fpath
data = json.dumps(self.inventory)
@@ -414,22 +414,22 @@ def main():
features = [
'extra_vars',
'include_params',
#'role_params', # FIXME: we don't yet validate tasks within a role
# 'role_params', # FIXME: we don't yet validate tasks within a role
'set_fact',
#'registered_vars', # FIXME: hard to simulate
# 'registered_vars', # FIXME: hard to simulate
'include_vars',
#'role_dep_params',
# 'role_dep_params',
'task_vars',
'block_vars',
'role_var',
'vars_file',
'play_var',
#'host_facts', # FIXME: hard to simulate
# 'host_facts', # FIXME: hard to simulate
'pb_host_vars_file',
'ini_host_vars_file',
'ini_host',
'pb_group_vars_file_child',
#'ini_group_vars_file_child', #FIXME: this contradicts documented precedence pb group vars files should override inventory ones
# 'ini_group_vars_file_child', #FIXME: this contradicts documented precedence pb group vars files should override inventory ones
'pb_group_vars_file_parent',
'ini_group_vars_file_parent',
'pb_group_vars_file_all',
@@ -489,7 +489,7 @@ def main():
dinv = options.use_dynamic_inventory
if dinv:
# some features are specific to ini, so swap those
for idx,x in enumerate(features):
for (idx, x) in enumerate(features):
if x.startswith('ini_') and 'vars_file' not in x:
features[idx] = x.replace('ini_', 'script_')

View File

@@ -821,110 +821,3 @@ lib/ansible/utils/path.py
lib/ansible/utils/ssh_functions.py
lib/ansible/utils/vars.py
lib/ansible/vars/manager.py
setup.py
test/integration/cleanup_azure.py
test/integration/cleanup_ec2.py
test/integration/cleanup_gce.py
test/integration/cleanup_rax.py
test/integration/gce_credentials.py
test/integration/setup_gce.py
test/integration/targets/async/library/async_test.py
test/integration/targets/uri/files/testserver.py
test/sanity/code-smell/ansible-var-precedence-check.py
test/units/cli/test_galaxy.py
test/units/contrib/inventory/test_vmware_inventory.py
test/units/errors/test_errors.py
test/units/executor/module_common/test_recursive_finder.py
test/units/executor/test_play_iterator.py
test/units/executor/test_playbook_executor.py
test/units/executor/test_task_executor.py
test/units/executor/test_task_result.py
test/units/inventory/test_inventory.py
test/units/mock/generator.py
test/units/mock/loader.py
test/units/module_utils/basic/test__log_invocation.py
test/units/module_utils/basic/test_deprecate_warn.py
test/units/module_utils/basic/test_exit_json.py
test/units/module_utils/basic/test_heuristic_log_sanitize.py
test/units/module_utils/basic/test_log.py
test/units/module_utils/basic/test_no_log.py
test/units/module_utils/basic/test_run_command.py
test/units/module_utils/basic/test_safe_eval.py
test/units/module_utils/basic/test_set_mode_if_different.py
test/units/module_utils/ec2/test_aws.py
test/units/module_utils/json_utils/test_filter_non_json_lines.py
test/units/module_utils/test_basic.py
test/units/module_utils/test_distribution_version.py
test/units/module_utils/test_facts.py
test/units/module_utils/test_postgresql.py
test/units/module_utils/test_text.py
test/units/modules/cloud/amazon/test_ec2_vpc_nat_gateway.py
test/units/modules/cloud/amazon/test_lambda.py
test/units/modules/cloud/amazon/test_s3.py
test/units/modules/cloud/docker/test_docker.py
test/units/modules/cloud/google/test_gce_tag.py
test/units/modules/cloud/openstack/test_os_server.py
test/units/modules/network/cumulus/test_nclu.py
test/units/modules/network/eos/eos_module.py
test/units/modules/network/eos/test_eos_command.py
test/units/modules/network/eos/test_eos_config.py
test/units/modules/network/eos/test_eos_system.py
test/units/modules/network/eos/test_eos_user.py
test/units/modules/network/ios/ios_module.py
test/units/modules/network/ios/test_ios_banner.py
test/units/modules/network/ios/test_ios_command.py
test/units/modules/network/ios/test_ios_config.py
test/units/modules/network/ios/test_ios_system.py
test/units/modules/network/ios/test_ios_template.py
test/units/modules/network/ios/test_ios_vrf.py
test/units/modules/network/iosxr/iosxr_module.py
test/units/modules/network/iosxr/test_iosxr_config.py
test/units/modules/network/iosxr/test_iosxr_facts.py
test/units/modules/network/iosxr/test_iosxr_system.py
test/units/modules/network/nxos/nxos_module.py
test/units/modules/network/nxos/test_nxos_command.py
test/units/modules/network/nxos/test_nxos_config.py
test/units/modules/network/nxos/test_nxos_evpn_global.py
test/units/modules/network/nxos/test_nxos_system.py
test/units/modules/network/vyos/test_vyos_command.py
test/units/modules/network/vyos/vyos_module.py
test/units/modules/packaging/os/test_apt.py
test/units/parsing/test_dataloader.py
test/units/parsing/test_mod_args.py
test/units/parsing/utils/test_addresses.py
test/units/parsing/utils/test_jsonify.py
test/units/parsing/vault/test_vault.py
test/units/parsing/vault/test_vault_editor.py
test/units/parsing/yaml/test_dumper.py
test/units/parsing/yaml/test_loader.py
test/units/parsing/yaml/test_objects.py
test/units/playbook/role/test_role.py
test/units/playbook/test_attribute.py
test/units/playbook/test_base.py
test/units/playbook/test_block.py
test/units/playbook/test_conditional.py
test/units/playbook/test_helpers.py
test/units/playbook/test_play_context.py
test/units/playbook/test_playbook.py
test/units/playbook/test_taggable.py
test/units/playbook/test_task.py
test/units/plugins/action/test_action.py
test/units/plugins/action/test_raw.py
test/units/plugins/action/test_synchronize.py
test/units/plugins/connection/test_connection.py
test/units/plugins/connection/test_netconf.py
test/units/plugins/connection/test_network_cli.py
test/units/plugins/connection/test_ssh.py
test/units/plugins/lookup/test_ini.py
test/units/plugins/lookup/test_password.py
test/units/plugins/strategy/test_strategy_base.py
test/units/plugins/test_plugins.py
test/units/template/test_safe_eval.py
test/units/template/test_templar.py
test/units/template/test_template_utilities.py
test/units/template/test_vars.py
test/units/test_constants.py
test/units/utils/test_helpers.py
test/units/utils/test_shlex.py
test/units/utils/test_vars.py
test/units/vars/test_variable_manager.py