From 8f50f84981f354e0dbac0af843d7d936c319b77f Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Thu, 20 Feb 2020 09:46:55 +0000 Subject: Bump to hacking 2.x This is compatible with Python 3-only syntax. Change-Id: I462f4242b9a5f8d8cd6b0cb3d328dfd9d93ba200 Signed-off-by: Stephen Finucane --- novaclient/tests/functional/v2/test_servers.py | 2 +- novaclient/tests/unit/test_shell.py | 2 +- novaclient/tests/unit/utils.py | 1 + novaclient/tests/unit/v2/test_shell.py | 2 +- novaclient/v2/shell.py | 9 ++++----- test-requirements.txt | 2 +- tox.ini | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/novaclient/tests/functional/v2/test_servers.py b/novaclient/tests/functional/v2/test_servers.py index a25dd2ae..3de668dd 100644 --- a/novaclient/tests/functional/v2/test_servers.py +++ b/novaclient/tests/functional/v2/test_servers.py @@ -288,7 +288,7 @@ class TestServersDetailsFlavorInfo(base.ClientTestBase): flavor_details, key) server_flavor_val = self._get_value_from_the_table( server_details, flavor_key_mapping[key]) - if key is "swap" and flavor_val is "": + if key == "swap" and flavor_val == "": # "flavor-show" displays zero swap as empty string. flavor_val = '0' self.assertEqual(flavor_val, server_flavor_val) diff --git a/novaclient/tests/unit/test_shell.py b/novaclient/tests/unit/test_shell.py index 9ef6141f..2c6af3b4 100644 --- a/novaclient/tests/unit/test_shell.py +++ b/novaclient/tests/unit/test_shell.py @@ -433,7 +433,7 @@ class ShellTest(utils.TestCase): if required is None: required = [ '.*?^usage: ', - '.*?^\s+set-password\s+Change the admin password', + '.*?^\\s+set-password\\s+Change the admin password', '.*?^See "nova help COMMAND" for help on a specific command', ] stdout, stderr = self.shell(command) diff --git a/novaclient/tests/unit/utils.py b/novaclient/tests/unit/utils.py index 229d999e..f987fc3e 100644 --- a/novaclient/tests/unit/utils.py +++ b/novaclient/tests/unit/utils.py @@ -44,6 +44,7 @@ def _patch_mock_to_raise_for_invalid_assert_calls(): mock.Mock.__getattr__ = raise_for_invalid_assert_calls( mock.Mock.__getattr__) + # NOTE(gibi): needs to be called only once at import time # to patch the mock lib _patch_mock_to_raise_for_invalid_assert_calls() diff --git a/novaclient/tests/unit/v2/test_shell.py b/novaclient/tests/unit/v2/test_shell.py index 6c3b3cfa..2473061d 100644 --- a/novaclient/tests/unit/v2/test_shell.py +++ b/novaclient/tests/unit/v2/test_shell.py @@ -1062,7 +1062,7 @@ class ShellTest(utils.TestCase): cmd = ('boot --image %s --flavor 1 ' '--nic net-name=blank some-server' % FAKE_UUID_1) # this should raise a multiple matches error - msg = 'No Network matching blank\..*' + msg = 'No Network matching blank\\..*' with testtools.ExpectedException(exceptions.CommandError, msg): self.run_command(cmd) diff --git a/novaclient/v2/shell.py b/novaclient/v2/shell.py index d8de74e8..773e6ce0 100644 --- a/novaclient/v2/shell.py +++ b/novaclient/v2/shell.py @@ -3112,11 +3112,10 @@ def _print_absolute_limits(limits): limit_list = [] for name in limit_names: - l = Limit(name, - used.get(name, "-"), - max.get(name, "-"), - other.get(name, "-")) - limit_list.append(l) + limit_list.append(Limit( + name, used.get(name, '-'), max.get(name, '-'), + other.get(name, '-'), + )) utils.print_list(limit_list, columns) diff --git a/test-requirements.txt b/test-requirements.txt index 88cad0e4..a11038e0 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>=1.1.0,<1.2.0 # Apache-2.0 +hacking>=2.0.0,<2.1.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 a5122f9c..fc1c9c99 100644 --- a/tox.ini +++ b/tox.ini @@ -88,8 +88,8 @@ commands = # # Following checks are ignored on purpose. # -# Additional checks are also ignored on purpose: F811, F821 -ignore = E731,F811,F821,H404,H405 +# Additional checks are also ignored on purpose: F811, F821, W504 +ignore = E731,F811,F821,H404,H405,W504 show-source = true exclude=.venv,.git,.tox,dist,*lib/python*,*egg,build,doc/source/conf.py,releasenotes -- cgit v1.2.1