From 35a9e55ea543bda3b26ac5193e168fe18d74dc58 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Thu, 28 May 2020 14:19:04 +0000 Subject: [PATCH] Fix pep8 issues --- zaza/openstack/charm_tests/tempest/setup.py | 42 +++++++++---------- .../charm_tests/tempest/templates/accounts.py | 1 + .../tempest/templates/tempest_v2.py | 1 + .../tempest/templates/tempest_v3.py | 1 + zaza/openstack/charm_tests/tempest/tests.py | 10 +++-- 5 files changed, 30 insertions(+), 25 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 7f97014..9f442bc 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -16,7 +16,6 @@ import urllib.parse import os -import shutil import subprocess import zaza.model @@ -44,7 +43,7 @@ TEMPEST_CIRROS_ALT_IMAGE_NAME = 'cirros_alt' def get_app_access_ip(application_name): - """Get the application's access IP + """Get the application's access IP. :param application_name: Name of application :type application_name: str @@ -65,7 +64,7 @@ def get_app_access_ip(application_name): def add_application_ips(ctxt): - """Add application access IPs to context + """Add application access IPs to context. :param ctxt: Context dictionary :type ctxt: dict @@ -78,7 +77,7 @@ def add_application_ips(ctxt): def add_nova_config(ctxt, keystone_session): - """Add nova config to context + """Add nova config to context. :param ctxt: Context dictionary :type ctxt: dict @@ -97,7 +96,7 @@ def add_nova_config(ctxt, keystone_session): def add_neutron_config(ctxt, keystone_session): - """Add neutron config to context + """Add neutron config to context. :param ctxt: Context dictionary :type ctxt: dict @@ -142,7 +141,7 @@ def add_neutron_config(ctxt, keystone_session): def add_glance_config(ctxt, keystone_session): - """Add glance config to context + """Add glance config to context. :param ctxt: Context dictionary :type ctxt: dict @@ -164,7 +163,7 @@ def add_glance_config(ctxt, keystone_session): def add_cinder_config(ctxt, keystone_session): - """Add cinder config to context + """Add cinder config to context. :param ctxt: Context dictionary :type ctxt: dict @@ -184,7 +183,7 @@ def add_cinder_config(ctxt, keystone_session): def add_keystone_config(ctxt, keystone_session): - """Add keystone config to context + """Add keystone config to context. :param ctxt: Context dictionary :type ctxt: dict @@ -202,7 +201,7 @@ def add_keystone_config(ctxt, keystone_session): def add_environment_var_config(ctxt): - """Add environment variable config to context + """Add environment variable config to context. :param ctxt: Context dictionary :type ctxt: dict @@ -221,7 +220,7 @@ def add_environment_var_config(ctxt): def add_auth_config(ctxt): - """Add authorization config to context + """Add authorization config to context. :param ctxt: Context dictionary :type ctxt: dict @@ -235,12 +234,12 @@ def add_auth_config(ctxt): if overcloud_auth['API_VERSION'] == 3: ctxt['admin_project_name'] = overcloud_auth['OS_PROJECT_NAME'] ctxt['admin_domain_name'] = overcloud_auth['OS_DOMAIN_NAME'] - ctxt['default_credentials_domain_name'] = overcloud_auth[ - 'OS_PROJECT_DOMAIN_NAME'] + ctxt['default_credentials_domain_name'] = ( + overcloud_auth['OS_PROJECT_DOMAIN_NAME']) def get_tempest_context(): - """Generate the tempest config context + """Generate the tempest config context. :returns: Context dictionary :rtype: dict @@ -259,7 +258,7 @@ def get_tempest_context(): def render_tempest_config(target_file, ctxt, template): - """Render tempest config for specified config file and template + """Render tempest config for specified config file and template. :param target_file: Name of file to render config to :type target_file: str @@ -276,7 +275,7 @@ def render_tempest_config(target_file, ctxt, template): def setup_tempest(tempest_template, accounts_template): - """Initialize tempest and render tempest config + """Initialize tempest and render tempest config. :param tempest_template: tempest.conf template :type tempest_template: module @@ -287,7 +286,8 @@ def setup_tempest(tempest_template, accounts_template): """ if os.path.isdir('tempest-workspace'): try: - subprocess.check_call(['tempest', 'workspace', 'remove', '--rmdir', '--name', 'tempest-workspace']) + subprocess.check_call(['tempest', 'workspace', 'remove', '--rmdir', + '--name', 'tempest-workspace']) except subprocess.CalledProcessError: pass try: @@ -305,7 +305,7 @@ def setup_tempest(tempest_template, accounts_template): def render_tempest_config_keystone_v2(): - """Render tempest config for Keystone V2 API + """Render tempest config for Keystone V2 API. :returns: None :rtype: None @@ -314,7 +314,7 @@ def render_tempest_config_keystone_v2(): def render_tempest_config_keystone_v3(): - """Render tempest config for Keystone V3 API + """Render tempest config for Keystone V3 API. :returns: None :rtype: None @@ -323,7 +323,7 @@ def render_tempest_config_keystone_v3(): def add_cirros_alt_image(): - """Add cirros alternate image to overcloud + """Add cirros alternate image to overcloud. :returns: None :rtype: None @@ -336,7 +336,7 @@ def add_cirros_alt_image(): def add_tempest_flavors(): - """Add tempest flavors to overcloud + """Add tempest flavors to overcloud. :returns: None :rtype: None @@ -363,7 +363,7 @@ def add_tempest_flavors(): def add_tempest_roles(): - """Add tempest roles overcloud + """Add tempest roles overcloud. :returns: None :rtype: None diff --git a/zaza/openstack/charm_tests/tempest/templates/accounts.py b/zaza/openstack/charm_tests/tempest/templates/accounts.py index 3e5329d..0c5cf5a 100644 --- a/zaza/openstack/charm_tests/tempest/templates/accounts.py +++ b/zaza/openstack/charm_tests/tempest/templates/accounts.py @@ -1,3 +1,4 @@ +# flake8: noqa file_contents = """ - username: 'demo' tenant_name: 'demo' diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py index ecca5ce..c5649d0 100644 --- a/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py @@ -1,3 +1,4 @@ +# flake8: noqa file_contents = """ [DEFAULT] debug = false diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py index 7c95e3e..4f183dd 100644 --- a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py @@ -1,3 +1,4 @@ +# flake8: noqa file_contents = """ [DEFAULT] debug = false diff --git a/zaza/openstack/charm_tests/tempest/tests.py b/zaza/openstack/charm_tests/tempest/tests.py index bbc9d9e..d726930 100644 --- a/zaza/openstack/charm_tests/tempest/tests.py +++ b/zaza/openstack/charm_tests/tempest/tests.py @@ -20,15 +20,16 @@ import subprocess import zaza import zaza.charm_lifecycle.utils import zaza.charm_lifecycle.test -import tempest.cmd.main import tempfile + class TempestTest(): """Tempest test class.""" + test_runner = zaza.charm_lifecycle.test.DIRECT def run(self): - """Run tempest tests as specified in tests/tests.yaml + """Run tempest tests as specified in tests/tests.yaml. Test keys are parsed from ['tests_options']['tempest']['model'], where valid test keys are: smoke (bool), whitelist (list of tests), blacklist @@ -38,8 +39,9 @@ class TempestTest(): :rtype: bool """ charm_config = zaza.charm_lifecycle.utils.get_charm_config() - tempest_options = ['tempest', 'run', '--workspace', 'tempest-workspace', - '--config', 'tempest-workspace/etc/tempest.conf'] + tempest_options = ['tempest', 'run', '--workspace', + 'tempest-workspace', '--config', + 'tempest-workspace/etc/tempest.conf'] for model_alias in zaza.model.get_juju_model_aliases().keys(): tempest_test_key = model_alias if model_alias == zaza.charm_lifecycle.utils.DEFAULT_MODEL_ALIAS: