From ae328b923adbd2c2693e9dc53bb4c31a6ced423e Mon Sep 17 00:00:00 2001 From: Brian Haley Date: Tue, 9 Oct 2018 19:51:54 -0400 Subject: [PATCH] Fix flake8 H404 errors Fix H404 error and start enforcing it. Trivialfix Change-Id: I0c062733660031faf43838798a697daf6674ef14 --- .../api/admin/test_agent_availability_zone.py | 7 ++++--- .../api/admin/test_agent_management.py | 4 +--- neutron_tempest_plugin/api/admin/test_routers_dvr.py | 9 ++++++--- neutron_tempest_plugin/api/admin/test_routers_ha.py | 9 ++++++--- neutron_tempest_plugin/api/base.py | 3 +-- neutron_tempest_plugin/api/clients.py | 4 +--- neutron_tempest_plugin/api/test_allowed_address_pair.py | 3 ++- .../api/test_auto_allocated_topology.py | 2 +- neutron_tempest_plugin/api/test_extra_dhcp_options.py | 2 +- neutron_tempest_plugin/api/test_flavors_extensions.py | 2 +- neutron_tempest_plugin/api/test_metering_extensions.py | 2 +- .../api/test_network_ip_availability.py | 2 +- neutron_tempest_plugin/api/test_networks.py | 2 +- neutron_tempest_plugin/api/test_subnetpools.py | 7 +++---- neutron_tempest_plugin/common/utils.py | 4 ++-- .../services/network/json/network_client.py | 5 +++-- tox.ini | 3 +-- 17 files changed, 36 insertions(+), 34 deletions(-) diff --git a/neutron_tempest_plugin/api/admin/test_agent_availability_zone.py b/neutron_tempest_plugin/api/admin/test_agent_availability_zone.py index 245715f0..c69c63dd 100644 --- a/neutron_tempest_plugin/api/admin/test_agent_availability_zone.py +++ b/neutron_tempest_plugin/api/admin/test_agent_availability_zone.py @@ -40,9 +40,10 @@ class AgentAvailabilityZoneTestCase(base.BaseAdminNetworkTest): @testtools.skipUnless(CONF.neutron_plugin_options.agent_availability_zone, "Need a single availability_zone assumption.") def test_agents_availability_zone(self): - """ - Test list agents availability_zone, only L3 and DHCP agent support - availability_zone, default availability_zone is "nova". + """Test list agents availability_zone + + Only L3 and DHCP agent support availability_zone, default + availability_zone is "nova". """ body = self.admin_client.list_agents() agents = body['agents'] diff --git a/neutron_tempest_plugin/api/admin/test_agent_management.py b/neutron_tempest_plugin/api/admin/test_agent_management.py index 72cba62c..ad0368ad 100644 --- a/neutron_tempest_plugin/api/admin/test_agent_management.py +++ b/neutron_tempest_plugin/api/admin/test_agent_management.py @@ -81,9 +81,7 @@ class AgentManagementTestJSON(base.BaseAdminNetworkTest): self.assertEqual(updated_description, description) def _restore_agent(self, dyn_agent): - """ - Restore the agent description after update test. - """ + """Restore the agent description after update test.""" description = dyn_agent['description'] origin_agent = {'description': description} self.admin_client.update_agent(agent_id=dyn_agent['id'], diff --git a/neutron_tempest_plugin/api/admin/test_routers_dvr.py b/neutron_tempest_plugin/api/admin/test_routers_dvr.py index 644bc386..8d80ba6a 100644 --- a/neutron_tempest_plugin/api/admin/test_routers_dvr.py +++ b/neutron_tempest_plugin/api/admin/test_routers_dvr.py @@ -44,7 +44,8 @@ class RoutersTestDVR(RoutersTestDVRBase): @decorators.idempotent_id('08a2a0a8-f1e4-4b34-8e30-e522e836c44e') def test_distributed_router_creation(self): - """ + """Test distributed router creation + Test uses administrative credentials to creates a DVR (Distributed Virtual Routing) router using the distributed=True. @@ -61,7 +62,8 @@ class RoutersTestDVR(RoutersTestDVRBase): @decorators.idempotent_id('8a0a72b4-7290-4677-afeb-b4ffe37bc352') def test_centralized_router_creation(self): - """ + """Test centralized router creation + Test uses administrative credentials to creates a CVR (Centralized Virtual Routing) router using the distributed=False. @@ -84,7 +86,8 @@ class RouterTestCentralizedToDVR(RoutersTestDVRBase): @decorators.idempotent_id('acd43596-c1fb-439d-ada8-31ad48ae3c2e') def test_centralized_router_update_to_dvr(self): - """ + """Test centralized to DVR router update + Test uses administrative credentials to creates a CVR (Centralized Virtual Routing) router using the distributed=False.Then it will "update" the router diff --git a/neutron_tempest_plugin/api/admin/test_routers_ha.py b/neutron_tempest_plugin/api/admin/test_routers_ha.py index d9aafe99..b717a10e 100644 --- a/neutron_tempest_plugin/api/admin/test_routers_ha.py +++ b/neutron_tempest_plugin/api/admin/test_routers_ha.py @@ -40,7 +40,8 @@ class RoutersTestHA(base.BaseRouterTest): @decorators.idempotent_id('8abc177d-14f1-4018-9f01-589b299cbee1') def test_ha_router_creation(self): - """ + """Test HA router creation + Test uses administrative credentials to create a HA (High Availability) router using the ha=True. @@ -53,7 +54,8 @@ class RoutersTestHA(base.BaseRouterTest): @decorators.idempotent_id('97b5f7ef-2192-4fa3-901e-979cd5c1097a') def test_legacy_router_creation(self): - """ + """Test legacy router creation + Test uses administrative credentials to create a SF (Single Failure) router using the ha=False. @@ -68,7 +70,8 @@ class RoutersTestHA(base.BaseRouterTest): @decorators.idempotent_id('5a6bfe82-5b23-45a4-b027-5160997d4753') def test_legacy_router_update_to_ha(self): - """ + """Test legacy to HA router update + Test uses administrative credentials to create a SF (Single Failure) router using the ha=False. Then it will "update" the router ha attribute to True diff --git a/neutron_tempest_plugin/api/base.py b/neutron_tempest_plugin/api/base.py index df0f4faf..c4bc71de 100644 --- a/neutron_tempest_plugin/api/base.py +++ b/neutron_tempest_plugin/api/base.py @@ -34,8 +34,7 @@ CONF = config.CONF class BaseNetworkTest(test.BaseTestCase): - """ - Base class for the Neutron tests that use the Tempest Neutron REST client + """Base class for Neutron tests that use the Tempest Neutron REST client Per the Neutron API Guide, API v1.x was removed from the source code tree (docs.openstack.org/api/openstack-network/2.0/content/Overview-d1e71.html) diff --git a/neutron_tempest_plugin/api/clients.py b/neutron_tempest_plugin/api/clients.py index ee0289c4..407e6946 100644 --- a/neutron_tempest_plugin/api/clients.py +++ b/neutron_tempest_plugin/api/clients.py @@ -29,9 +29,7 @@ CONF = config.CONF class Manager(manager.Manager): - """ - Top level manager for OpenStack tempest clients - """ + """Top level manager for OpenStack tempest clients""" default_params = { 'disable_ssl_certificate_validation': CONF.identity.disable_ssl_certificate_validation, diff --git a/neutron_tempest_plugin/api/test_allowed_address_pair.py b/neutron_tempest_plugin/api/test_allowed_address_pair.py index f34cc5bf..0137ff21 100644 --- a/neutron_tempest_plugin/api/test_allowed_address_pair.py +++ b/neutron_tempest_plugin/api/test_allowed_address_pair.py @@ -20,7 +20,8 @@ from neutron_tempest_plugin.api import base class AllowedAddressPairTestJSON(base.BaseNetworkTest): - """ + """AllowedAddressPairTestJSON class + Tests the Neutron Allowed Address Pair API extension using the Tempest REST client. The following API operations are tested with this extension: diff --git a/neutron_tempest_plugin/api/test_auto_allocated_topology.py b/neutron_tempest_plugin/api/test_auto_allocated_topology.py index 0baa2a80..4d70bfca 100644 --- a/neutron_tempest_plugin/api/test_auto_allocated_topology.py +++ b/neutron_tempest_plugin/api/test_auto_allocated_topology.py @@ -21,8 +21,8 @@ from neutron_tempest_plugin.api import base class TestAutoAllocatedTopology(base.BaseAdminNetworkTest): + """Tests Get-Me-A-Network - """ Tests the Get-Me-A-Network operations in the Neutron API using the REST client for Neutron. """ diff --git a/neutron_tempest_plugin/api/test_extra_dhcp_options.py b/neutron_tempest_plugin/api/test_extra_dhcp_options.py index e5f73b25..cb4dba8a 100644 --- a/neutron_tempest_plugin/api/test_extra_dhcp_options.py +++ b/neutron_tempest_plugin/api/test_extra_dhcp_options.py @@ -20,8 +20,8 @@ from neutron_tempest_plugin.api import base class ExtraDHCPOptionsTestJSON(base.BaseNetworkTest): + """Test Extra DHCP Options - """ Tests the following operations with the Extra DHCP Options Neutron API extension: diff --git a/neutron_tempest_plugin/api/test_flavors_extensions.py b/neutron_tempest_plugin/api/test_flavors_extensions.py index 30f1eb6c..42eb7b1a 100644 --- a/neutron_tempest_plugin/api/test_flavors_extensions.py +++ b/neutron_tempest_plugin/api/test_flavors_extensions.py @@ -19,8 +19,8 @@ from neutron_tempest_plugin.api import base class TestFlavorsJson(base.BaseAdminNetworkTest): + """Test Flavors - """ Tests the following operations in the Neutron API using the REST client for Neutron: diff --git a/neutron_tempest_plugin/api/test_metering_extensions.py b/neutron_tempest_plugin/api/test_metering_extensions.py index 745a8d00..ceeb2b69 100644 --- a/neutron_tempest_plugin/api/test_metering_extensions.py +++ b/neutron_tempest_plugin/api/test_metering_extensions.py @@ -23,8 +23,8 @@ LONG_NAME_OK = 'x' * db_const.NAME_FIELD_SIZE class MeteringTestJSON(base.BaseAdminNetworkTest): + """Test Metering - """ Tests the following operations in the Neutron API using the REST client for Neutron: diff --git a/neutron_tempest_plugin/api/test_network_ip_availability.py b/neutron_tempest_plugin/api/test_network_ip_availability.py index 10aee2e7..1cdfc7e7 100644 --- a/neutron_tempest_plugin/api/test_network_ip_availability.py +++ b/neutron_tempest_plugin/api/test_network_ip_availability.py @@ -37,8 +37,8 @@ DELETE_SLEEP = 2 class NetworksIpAvailabilityTest(base.BaseAdminNetworkTest): + """Tests Networks IP Availability - """ Tests the following operations in the Neutron API using the REST client for Neutron: diff --git a/neutron_tempest_plugin/api/test_networks.py b/neutron_tempest_plugin/api/test_networks.py index 63e8ae55..f9d52baa 100644 --- a/neutron_tempest_plugin/api/test_networks.py +++ b/neutron_tempest_plugin/api/test_networks.py @@ -22,8 +22,8 @@ from neutron_tempest_plugin import config class NetworksTestJSON(base.BaseNetworkTest): + """Test Networks - """ Tests the following operations in the Neutron API using the REST client for Neutron: diff --git a/neutron_tempest_plugin/api/test_subnetpools.py b/neutron_tempest_plugin/api/test_subnetpools.py index 25d97801..9d927cfe 100644 --- a/neutron_tempest_plugin/api/test_subnetpools.py +++ b/neutron_tempest_plugin/api/test_subnetpools.py @@ -58,7 +58,8 @@ class SubnetPoolsTest(SubnetPoolsTestBase): new_prefix = u'10.11.15.0/24' larger_prefix = u'10.11.0.0/16' - """ + """Test Subnet Pools + Tests the following operations in the Neutron API using the REST client for Neutron: @@ -327,9 +328,7 @@ class SubnetPoolsTest(SubnetPoolsTestBase): @decorators.idempotent_id('4c6963c2-f54c-4347-b288-75d18421c4c4') @utils.requires_ext(extension='default-subnetpools', service='network') def test_tenant_create_non_default_subnetpool(self): - """ - Test creates a subnetpool, the "is_default" attribute is False. - """ + """Test creates a subnetpool, the "is_default" attribute is False.""" created_subnetpool = self._create_subnetpool() self.assertFalse(created_subnetpool['is_default']) diff --git a/neutron_tempest_plugin/common/utils.py b/neutron_tempest_plugin/common/utils.py index c42d9849..76fb38fd 100644 --- a/neutron_tempest_plugin/common/utils.py +++ b/neutron_tempest_plugin/common/utils.py @@ -54,8 +54,8 @@ class LockWithTimer(object): def wait_until_true(predicate, timeout=60, sleep=1, exception=None): - """ - Wait until callable predicate is evaluated as True + """Wait until callable predicate is evaluated as True + :param predicate: Callable deciding whether waiting should continue. Best practice is to instantiate predicate with functools.partial() :param timeout: Timeout in seconds how long should function wait. diff --git a/neutron_tempest_plugin/services/network/json/network_client.py b/neutron_tempest_plugin/services/network/json/network_client.py index 0d26a0e4..58dfbf42 100644 --- a/neutron_tempest_plugin/services/network/json/network_client.py +++ b/neutron_tempest_plugin/services/network/json/network_client.py @@ -19,8 +19,8 @@ from tempest.lib import exceptions as lib_exc class NetworkClientJSON(service_client.RestClient): + """NetworkClientJSON class - """ Tempest REST client for Neutron. Uses v2 of the Neutron API, since the V1 API has been removed from the code base. @@ -447,7 +447,8 @@ class NetworkClientJSON(service_client.RestClient): return service_client.ResponseBody(resp, body) def update_agent(self, agent_id, agent_info): - """ + """Update an agent + :param agent_info: Agent update information. E.g {"admin_state_up": True} """ diff --git a/tox.ini b/tox.ini index 5eb8b10b..20a7debe 100644 --- a/tox.ini +++ b/tox.ini @@ -57,10 +57,9 @@ commands = oslo_debug_helper -t neutron_tempest_plugin/ {posargs} # E128 continuation line under-indented for visual indent # E129 visually indented line with same indent as next logical line # E265 block comment should start with '# ' -# H404 multi line docstring should start with a summary # H405 multi line docstring summary not separated with an empty line # N530 direct neutron imports not allowed -ignore = E125,E126,E128,E129,E265,H404,H405,N530 +ignore = E125,E126,E128,E129,E265,H405,N530 # H106: Don't put vim configuration in source files # H203: Use assertIs(Not)None to check for None # H904: Delay string interpolations at logging calls