diff --git a/nova/api/openstack/compute/console_auth_tokens.py b/nova/api/openstack/compute/console_auth_tokens.py index 41755d1232..ae838fe857 100644 --- a/nova/api/openstack/compute/console_auth_tokens.py +++ b/nova/api/openstack/compute/console_auth_tokens.py @@ -76,5 +76,5 @@ class ConsoleAuthTokensController(wsgi.Controller): @wsgi.Controller.api_version("2.31") # noqa @wsgi.expected_errors((400, 404)) - def show(self, req, id): + def show(self, req, id): # noqa return self._show(req, id, False) diff --git a/nova/api/openstack/compute/hypervisors.py b/nova/api/openstack/compute/hypervisors.py index 3d6f2d6082..107996a18e 100644 --- a/nova/api/openstack/compute/hypervisors.py +++ b/nova/api/openstack/compute/hypervisors.py @@ -210,13 +210,13 @@ class HypervisorsController(wsgi.Controller): @wsgi.Controller.api_version("2.33", "2.52") # noqa @validation.query_schema(hyper_schema.list_query_schema_v233) @wsgi.expected_errors(400) - def index(self, req): + def index(self, req): # noqa limit, marker = common.get_limit_and_marker(req) return self._index(req, limit=limit, marker=marker, links=True) @wsgi.Controller.api_version("2.1", "2.32") # noqa @wsgi.expected_errors(()) - def index(self, req): + def index(self, req): # noqa return self._index(req) def _index(self, req, limit=None, marker=None, links=False): @@ -242,13 +242,13 @@ class HypervisorsController(wsgi.Controller): @wsgi.Controller.api_version("2.33", "2.52") # noqa @validation.query_schema(hyper_schema.list_query_schema_v233) @wsgi.expected_errors((400)) - def detail(self, req): + def detail(self, req): # noqa limit, marker = common.get_limit_and_marker(req) return self._detail(req, limit=limit, marker=marker, links=True) @wsgi.Controller.api_version("2.1", "2.32") # noqa @wsgi.expected_errors(()) - def detail(self, req): + def detail(self, req): # noqa return self._detail(req) def _detail(self, req, limit=None, marker=None, links=False): @@ -300,7 +300,7 @@ class HypervisorsController(wsgi.Controller): @wsgi.Controller.api_version("2.1", "2.52") # noqa F811 @wsgi.expected_errors(404) - def show(self, req, id): + def show(self, req, id): # noqa return self._show(req, id) def _show(self, req, id, with_servers=False): diff --git a/nova/api/openstack/compute/instance_actions.py b/nova/api/openstack/compute/instance_actions.py index d0b58fff6f..8de6a8358d 100644 --- a/nova/api/openstack/compute/instance_actions.py +++ b/nova/api/openstack/compute/instance_actions.py @@ -77,7 +77,7 @@ class InstanceActionsController(wsgi.Controller): return common.get_instance(self.compute_api, context, server_id) @wsgi.Controller.api_version("2.21") # noqa - def _get_instance(self, req, context, server_id): + def _get_instance(self, req, context, server_id): # noqa with utils.temporary_mutation(context, read_deleted='yes'): return common.get_instance(self.compute_api, context, server_id) @@ -100,7 +100,7 @@ class InstanceActionsController(wsgi.Controller): "2.66") @validation.query_schema(schema_instance_actions.list_query_params_v258, "2.58", "2.65") - def index(self, req, server_id): + def index(self, req, server_id): # noqa """Returns the list of actions recorded for a given instance.""" context = req.environ["nova.context"] instance = self._get_instance(req, context, server_id) diff --git a/nova/api/openstack/compute/keypairs.py b/nova/api/openstack/compute/keypairs.py index 502932cf9a..1fa1684322 100644 --- a/nova/api/openstack/compute/keypairs.py +++ b/nova/api/openstack/compute/keypairs.py @@ -64,7 +64,7 @@ class KeypairController(wsgi.Controller): @wsgi.response(201) @wsgi.expected_errors((400, 403, 409)) @validation.schema(keypairs.create_v22) - def create(self, req, body): + def create(self, req, body): # noqa """Create or import keypair. Sending name will generate a key and return private_key @@ -85,7 +85,7 @@ class KeypairController(wsgi.Controller): @wsgi.expected_errors((400, 403, 409)) @validation.schema(keypairs.create_v20, "2.0", "2.0") @validation.schema(keypairs.create, "2.1", "2.1") - def create(self, req, body): + def create(self, req, body): # noqa """Create or import keypair. Sending name will generate a key and return private_key @@ -142,7 +142,7 @@ class KeypairController(wsgi.Controller): @validation.query_schema(keypairs.delete_query_schema_v20) @wsgi.response(204) @wsgi.expected_errors(404) - def delete(self, req, id): + def delete(self, req, id): # noqa self._delete(req, id) @wsgi.Controller.api_version("2.10") # noqa @@ -150,7 +150,7 @@ class KeypairController(wsgi.Controller): @validation.query_schema(keypairs.delete_query_schema_v210, '2.10', '2.74') @wsgi.response(204) @wsgi.expected_errors(404) - def delete(self, req, id): + def delete(self, req, id): # noqa # handle optional user-id for admin only user_id = self._get_user_id(req) self._delete(req, id, user_id=user_id) @@ -184,13 +184,13 @@ class KeypairController(wsgi.Controller): @wsgi.Controller.api_version("2.2", "2.9") # noqa @validation.query_schema(keypairs.show_query_schema_v20) @wsgi.expected_errors(404) - def show(self, req, id): + def show(self, req, id): # noqa return self._show(req, id, key_type=True) @wsgi.Controller.api_version("2.1", "2.1") # noqa @validation.query_schema(keypairs.show_query_schema_v20) @wsgi.expected_errors(404) - def show(self, req, id): + def show(self, req, id): # noqa return self._show(req, id) def _show(self, req, id, key_type=False, user_id=None): @@ -217,7 +217,7 @@ class KeypairController(wsgi.Controller): @wsgi.Controller.api_version("2.10", "2.34") # noqa @validation.query_schema(keypairs.index_query_schema_v210) @wsgi.expected_errors(()) - def index(self, req): + def index(self, req): # noqa # handle optional user-id for admin only user_id = self._get_user_id(req) return self._index(req, key_type=True, user_id=user_id) @@ -225,13 +225,13 @@ class KeypairController(wsgi.Controller): @wsgi.Controller.api_version("2.2", "2.9") # noqa @validation.query_schema(keypairs.index_query_schema_v20) @wsgi.expected_errors(()) - def index(self, req): + def index(self, req): # noqa return self._index(req, key_type=True) @wsgi.Controller.api_version("2.1", "2.1") # noqa @validation.query_schema(keypairs.index_query_schema_v20) @wsgi.expected_errors(()) - def index(self, req): + def index(self, req): # noqa return self._index(req) def _index(self, req, key_type=False, user_id=None, links=False): diff --git a/nova/api/openstack/compute/limits.py b/nova/api/openstack/compute/limits.py index 38c2b3a235..e6f901e09d 100644 --- a/nova/api/openstack/compute/limits.py +++ b/nova/api/openstack/compute/limits.py @@ -51,24 +51,24 @@ class LimitsController(wsgi.Controller): return self._index(req) @wsgi.Controller.api_version(MIN_WITHOUT_PROXY_API_SUPPORT_VERSION, # noqa - MAX_IMAGE_META_PROXY_API_VERSION) # noqa + MAX_IMAGE_META_PROXY_API_VERSION) @wsgi.expected_errors(()) @validation.query_schema(limits.limits_query_schema) - def index(self, req): + def index(self, req): # noqa return self._index(req, FILTERED_LIMITS_2_36) @wsgi.Controller.api_version( # noqa - MIN_WITHOUT_IMAGE_META_PROXY_API_VERSION, '2.56') # noqa + MIN_WITHOUT_IMAGE_META_PROXY_API_VERSION, '2.56') @wsgi.expected_errors(()) @validation.query_schema(limits.limits_query_schema) - def index(self, req): + def index(self, req): # noqa return self._index(req, FILTERED_LIMITS_2_36, max_image_meta=False) @wsgi.Controller.api_version('2.57') # noqa @wsgi.expected_errors(()) @validation.query_schema(limits.limits_query_schema_275, '2.75') @validation.query_schema(limits.limits_query_schema, '2.57', '2.74') - def index(self, req): + def index(self, req): # noqa return self._index(req, FILTERED_LIMITS_2_57, max_image_meta=False) def _index(self, req, filtered_limits=None, max_image_meta=True): diff --git a/nova/api/openstack/compute/migrations.py b/nova/api/openstack/compute/migrations.py index 49e5b4eaa3..acefc97a20 100644 --- a/nova/api/openstack/compute/migrations.py +++ b/nova/api/openstack/compute/migrations.py @@ -153,7 +153,7 @@ class MigrationsController(wsgi.Controller): @wsgi.expected_errors(()) @validation.query_schema(schema_migrations.list_query_schema_v20, "2.23", "2.58") - def index(self, req): + def index(self, req): # noqa """Return all migrations using the query parameters as filters.""" return self._index(req, add_link=True) @@ -161,7 +161,7 @@ class MigrationsController(wsgi.Controller): @wsgi.expected_errors(400) @validation.query_schema(schema_migrations.list_query_params_v259, "2.59", "2.65") - def index(self, req): + def index(self, req): # noqa """Return all migrations using the query parameters as filters.""" limit, marker = common.get_limit_and_marker(req) return self._index(req, add_link=True, next_link=True, add_uuid=True, @@ -176,7 +176,7 @@ class MigrationsController(wsgi.Controller): "2.66", "2.79") @validation.query_schema(schema_migrations.list_query_params_v280, "2.80") - def index(self, req): + def index(self, req): # noqa """Return all migrations using the query parameters as filters.""" limit, marker = common.get_limit_and_marker(req) return self._index(req, add_link=True, next_link=True, add_uuid=True, diff --git a/nova/api/openstack/compute/quota_classes.py b/nova/api/openstack/compute/quota_classes.py index 0077ff9158..741ce5f848 100644 --- a/nova/api/openstack/compute/quota_classes.py +++ b/nova/api/openstack/compute/quota_classes.py @@ -82,12 +82,12 @@ class QuotaClassSetsController(wsgi.Controller): @wsgi.Controller.api_version('2.50', '2.56') # noqa @wsgi.expected_errors(()) - def show(self, req, id): + def show(self, req, id): # noqa return self._show(req, id, FILTERED_QUOTAS_2_50) @wsgi.Controller.api_version('2.57') # noqa @wsgi.expected_errors(()) - def show(self, req, id): + def show(self, req, id): # noqa return self._show(req, id, FILTERED_QUOTAS_2_57) def _show(self, req, id, filtered_quotas=None, @@ -107,13 +107,13 @@ class QuotaClassSetsController(wsgi.Controller): @wsgi.Controller.api_version("2.50", "2.56") # noqa @wsgi.expected_errors(400) @validation.schema(quota_classes.update_v250) - def update(self, req, id, body): + def update(self, req, id, body): # noqa return self._update(req, id, body, FILTERED_QUOTAS_2_50) @wsgi.Controller.api_version("2.57") # noqa @wsgi.expected_errors(400) @validation.schema(quota_classes.update_v257) - def update(self, req, id, body): + def update(self, req, id, body): # noqa return self._update(req, id, body, FILTERED_QUOTAS_2_57) def _update(self, req, id, body, filtered_quotas=None, diff --git a/nova/api/openstack/compute/quota_sets.py b/nova/api/openstack/compute/quota_sets.py index 867dad4220..220224cbd5 100644 --- a/nova/api/openstack/compute/quota_sets.py +++ b/nova/api/openstack/compute/quota_sets.py @@ -112,12 +112,12 @@ class QuotaSetsController(wsgi.Controller): @wsgi.Controller.api_version( # noqa MIN_WITHOUT_PROXY_API_SUPPORT_VERSION, '2.56') @wsgi.expected_errors(400) - def show(self, req, id): + def show(self, req, id): # noqa return self._show(req, id, FILTERED_QUOTAS_2_36) @wsgi.Controller.api_version('2.57') # noqa @wsgi.expected_errors(400) - def show(self, req, id): + def show(self, req, id): # noqa return self._show(req, id, FILTERED_QUOTAS_2_57) @validation.query_schema(quota_sets.query_schema_275, '2.75') @@ -141,12 +141,12 @@ class QuotaSetsController(wsgi.Controller): @wsgi.Controller.api_version( # noqa MIN_WITHOUT_PROXY_API_SUPPORT_VERSION, '2.56') @wsgi.expected_errors(400) - def detail(self, req, id): + def detail(self, req, id): # noqa return self._detail(req, id, FILTERED_QUOTAS_2_36) @wsgi.Controller.api_version('2.57') # noqa @wsgi.expected_errors(400) - def detail(self, req, id): + def detail(self, req, id): # noqa return self._detail(req, id, FILTERED_QUOTAS_2_57) @validation.query_schema(quota_sets.query_schema_275, '2.75') @@ -172,13 +172,13 @@ class QuotaSetsController(wsgi.Controller): MIN_WITHOUT_PROXY_API_SUPPORT_VERSION, '2.56') @wsgi.expected_errors(400) @validation.schema(quota_sets.update_v236) - def update(self, req, id, body): + def update(self, req, id, body): # noqa return self._update(req, id, body, FILTERED_QUOTAS_2_36) @wsgi.Controller.api_version('2.57') # noqa @wsgi.expected_errors(400) @validation.schema(quota_sets.update_v257) - def update(self, req, id, body): + def update(self, req, id, body): # noqa return self._update(req, id, body, FILTERED_QUOTAS_2_57) @validation.query_schema(quota_sets.query_schema_275, '2.75') @@ -247,12 +247,12 @@ class QuotaSetsController(wsgi.Controller): @wsgi.Controller.api_version( # noqa MIN_WITHOUT_PROXY_API_SUPPORT_VERSION, '2.56') @wsgi.expected_errors(400) - def defaults(self, req, id): + def defaults(self, req, id): # noqa return self._defaults(req, id, FILTERED_QUOTAS_2_36) @wsgi.Controller.api_version('2.57') # noqa @wsgi.expected_errors(400) - def defaults(self, req, id): + def defaults(self, req, id): # noqa return self._defaults(req, id, FILTERED_QUOTAS_2_57) def _defaults(self, req, id, filtered_quotas): diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index d70bd8d45f..40a2be2e0a 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -101,7 +101,8 @@ class ServersController(wsgi.Controller): if 'server' not in robj.obj: return robj - link = [l for l in robj.obj['server']['links'] if l['rel'] == 'self'] + link = [link for link in robj.obj['server'][ + 'links'] if link['rel'] == 'self'] if link: robj['Location'] = link[0]['href'] diff --git a/nova/api/openstack/compute/services.py b/nova/api/openstack/compute/services.py index 04fe299077..b462b1a9d9 100644 --- a/nova/api/openstack/compute/services.py +++ b/nova/api/openstack/compute/services.py @@ -380,7 +380,7 @@ class ServiceController(wsgi.Controller): @wsgi.Controller.api_version(UUID_FOR_ID_MIN_VERSION) # noqa F811 @wsgi.expected_errors((400, 404)) @validation.schema(services.service_update_v2_53, UUID_FOR_ID_MIN_VERSION) - def update(self, req, id, body): + def update(self, req, id, body): # noqa """Perform service update Starting with microversion 2.53, the service uuid is passed in on the diff --git a/nova/api/openstack/compute/simple_tenant_usage.py b/nova/api/openstack/compute/simple_tenant_usage.py index f1bef343f4..55f319dc21 100644 --- a/nova/api/openstack/compute/simple_tenant_usage.py +++ b/nova/api/openstack/compute/simple_tenant_usage.py @@ -273,7 +273,7 @@ class SimpleTenantUsageController(wsgi.Controller): @wsgi.Controller.api_version("2.1", "2.39") # noqa @validation.query_schema(schema.index_query) @wsgi.expected_errors(400) - def index(self, req): + def index(self, req): # noqa """Retrieve tenant_usage for all tenants.""" return self._index(req) @@ -288,7 +288,7 @@ class SimpleTenantUsageController(wsgi.Controller): @wsgi.Controller.api_version("2.1", "2.39") # noqa @validation.query_schema(schema.show_query) @wsgi.expected_errors(400) - def show(self, req, id): + def show(self, req, id): # noqa """Retrieve tenant_usage for a specified tenant.""" return self._show(req, id) diff --git a/nova/db/sqlalchemy/migrate_repo/versions/330_enforce_mitaka_online_migrations.py b/nova/db/sqlalchemy/migrate_repo/versions/330_enforce_mitaka_online_migrations.py index 3649f13e2d..4c2d783900 100644 --- a/nova/db/sqlalchemy/migrate_repo/versions/330_enforce_mitaka_online_migrations.py +++ b/nova/db/sqlalchemy/migrate_repo/versions/330_enforce_mitaka_online_migrations.py @@ -29,7 +29,7 @@ def upgrade(migrate_engine): for table in (compute_nodes, aggregates): count = select([func.count()]).select_from(table).where(and_( table.c.deleted == 0, - table.c.uuid == None)).execute().scalar() # NOQA + table.c.uuid == None)).execute().scalar() # noqa if count > 0: msg = WARNING_MSG % { 'count': count, @@ -45,8 +45,8 @@ def upgrade(migrate_engine): # if the definition is altered. count = select([func.count()]).select_from(pci_devices).where(and_( pci_devices.c.deleted == 0, - pci_devices.c.parent_addr == None, - pci_devices.c.dev_type == 'type-VF')).execute().scalar() # NOQA + pci_devices.c.parent_addr == None, # noqa + pci_devices.c.dev_type == 'type-VF')).execute().scalar() if count > 0: msg = WARNING_MSG % { 'count': count, diff --git a/nova/tests/unit/api/openstack/compute/microversions.py b/nova/tests/unit/api/openstack/compute/microversions.py index 82eeab0340..5582cea427 100644 --- a/nova/tests/unit/api/openstack/compute/microversions.py +++ b/nova/tests/unit/api/openstack/compute/microversions.py @@ -31,12 +31,12 @@ class MicroversionsController(wsgi.Controller): return data @wsgi.Controller.api_version("2.2") # noqa - def index(self, req): + def index(self, req): # noqa data = {'param': 'val2'} return data @wsgi.Controller.api_version("3.0") # noqa - def index(self, req): + def index(self, req): # noqa raise webob.exc.HTTPBadRequest() @@ -52,7 +52,7 @@ class MicroversionsController2(wsgi.Controller): @wsgi.Controller.api_version("2.5", "3.1") # noqa @wsgi.response(202) - def index(self, req): + def index(self, req): # noqa data = {'param': 'controller2_val2'} return data @@ -88,7 +88,7 @@ class MicroversionsController4(wsgi.Controller): return data @wsgi.Controller.api_version("2.2") # noqa - def _create(self, req): + def _create(self, req): # noqa data = {'param': 'controller4_val2'} return data diff --git a/nova/tests/unit/compute/test_compute_mgr.py b/nova/tests/unit/compute/test_compute_mgr.py index 0839458cca..20e13cdfff 100644 --- a/nova/tests/unit/compute/test_compute_mgr.py +++ b/nova/tests/unit/compute/test_compute_mgr.py @@ -6261,6 +6261,7 @@ class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase): mock_get_allocations, mock_ins_save, mock_spawn): accel_info = [{'k1': 'v1', 'k2': 'v2'}] + @contextlib.contextmanager def fake_build_resources(compute_mgr, *args, **kwargs): yield { diff --git a/nova/tests/unit/objects/test_objects.py b/nova/tests/unit/objects/test_objects.py index b5bd0f3241..1449dec068 100644 --- a/nova/tests/unit/objects/test_objects.py +++ b/nova/tests/unit/objects/test_objects.py @@ -881,7 +881,7 @@ class TestObjectSerializer(_BaseTestCase): } @base.NovaObjectRegistry.register # noqa - class Parent(base.NovaObject): + class Parent(base.NovaObject): # noqa VERSION = '1.1' fields = { diff --git a/nova/tests/unit/virt/vmwareapi/test_driver_api.py b/nova/tests/unit/virt/vmwareapi/test_driver_api.py index 314f576b7b..a0c20a9d46 100644 --- a/nova/tests/unit/virt/vmwareapi/test_driver_api.py +++ b/nova/tests/unit/virt/vmwareapi/test_driver_api.py @@ -123,8 +123,7 @@ class VMwareDriverStartupTestCase(test.NoDBTestCase): self.flags(**startup_flags) with mock.patch( 'nova.virt.vmwareapi.driver.VMwareAPISession.__init__'): - e = self.assertRaises( - Exception, driver.VMwareVCDriver, None) # noqa + e = self.assertRaises(Exception, driver.VMwareVCDriver, None) # noqa self.assertIs(type(e), expected_exception_type) def test_start_driver_no_user(self): diff --git a/test-requirements.txt b/test-requirements.txt index d42fb05f18..5ec94aec9c 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,7 +2,7 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -hacking>=3.0.1,<3.1.0 # Apache-2.0 +hacking>=3.1.0,<3.2.0 # Apache-2.0 mypy>=0.761 # MIT coverage!=4.4,>=4.0 # Apache-2.0 ddt>=1.0.1 # MIT