diff --git a/lower-constraints.txt b/lower-constraints.txt index 5d9d5197d..350574be3 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -25,7 +25,7 @@ futurist==1.2.0 gitdb==0.6.4 GitPython==1.0.1 greenlet==0.4.10 -hacking==0.12.0 +hacking==1.1.0 idna==2.6 iso8601==0.1.11 Jinja2==2.10 diff --git a/novaclient/api_versions.py b/novaclient/api_versions.py index 231765198..5ff52b8f5 100644 --- a/novaclient/api_versions.py +++ b/novaclient/api_versions.py @@ -324,11 +324,11 @@ def update_headers(headers, api_version): def check_headers(response, api_version): """Checks that microversion header is in response.""" if api_version.ver_minor > 0: - if (api_version.ver_minor < 27 - and LEGACY_HEADER_NAME not in response.headers): + if (api_version.ver_minor < 27 and + LEGACY_HEADER_NAME not in response.headers): _warn_missing_microversion_header(LEGACY_HEADER_NAME) - elif (api_version.ver_minor >= 27 - and HEADER_NAME not in response.headers): + elif (api_version.ver_minor >= 27 and + HEADER_NAME not in response.headers): _warn_missing_microversion_header(HEADER_NAME) diff --git a/novaclient/client.py b/novaclient/client.py index 2d2716310..76a2007be 100644 --- a/novaclient/client.py +++ b/novaclient/client.py @@ -30,9 +30,6 @@ from keystoneauth1 import session as ksession from oslo_utils import importutils import pkg_resources -osprofiler_profiler = importutils.try_import("osprofiler.profiler") -osprofiler_web = importutils.try_import("osprofiler.web") - import novaclient from novaclient import api_versions from novaclient import exceptions @@ -40,6 +37,9 @@ from novaclient import extension as ext from novaclient.i18n import _ from novaclient import utils +osprofiler_profiler = importutils.try_import("osprofiler.profiler") +osprofiler_web = importutils.try_import("osprofiler.web") + # TODO(jichenjc): when an extension in contrib is moved to core extension, # Add the name into the following list, then after last patch merged, # remove the whole function diff --git a/novaclient/shell.py b/novaclient/shell.py index 8eb4311ce..2f6a33e81 100644 --- a/novaclient/shell.py +++ b/novaclient/shell.py @@ -29,8 +29,6 @@ from oslo_utils import importutils from oslo_utils import strutils import six -osprofiler_profiler = importutils.try_import("osprofiler.profiler") - import novaclient from novaclient import api_versions from novaclient import client @@ -39,6 +37,8 @@ import novaclient.extension from novaclient.i18n import _ from novaclient import utils +osprofiler_profiler = importutils.try_import("osprofiler.profiler") + DEFAULT_MAJOR_OS_COMPUTE_API_VERSION = "2.0" # The default behaviour of nova client CLI is that CLI negotiates with server # to find out the most recent version between client and server, and diff --git a/novaclient/tests/unit/fixture_data/server_groups.py b/novaclient/tests/unit/fixture_data/server_groups.py index 5c4c88c6f..d2fd43c7d 100644 --- a/novaclient/tests/unit/fixture_data/server_groups.py +++ b/novaclient/tests/unit/fixture_data/server_groups.py @@ -87,8 +87,8 @@ class Fixture(base.Fixture): headers=headers) self.requests_mock.get(self.url(all_projects=True), - json={'server_groups': server_groups - + other_project_server_groups}, + json={'server_groups': server_groups + + other_project_server_groups}, headers=headers) self.requests_mock.get(self.url(limit=2, offset=1), diff --git a/test-requirements.txt b/test-requirements.txt index b01fb80af..83326f074 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,7 +1,7 @@ # The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 +hacking>=1.1.0,<1.2.0 # Apache-2.0 bandit>=1.1.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index 508966826..0e6b4bbeb 100644 --- a/tox.ini +++ b/tox.ini @@ -93,7 +93,7 @@ commands = # Following checks are ignored on purpose. # # Additional checks are also ignored on purpose: F811, F821 -ignore = F811,F821,H404,H405 +ignore = E731,F811,F821,H404,H405 show-source = True exclude=.venv,.git,.tox,dist,*lib/python*,*egg,build,doc/source/conf.py,releasenotes