summaryrefslogtreecommitdiff
path: root/novaclient
diff options
context:
space:
mode:
authorStephen Finucane <sfinucan@redhat.com>2020-02-20 09:46:55 +0000
committerStephen Finucane <sfinucan@redhat.com>2020-02-21 09:48:38 +0000
commit8f50f84981f354e0dbac0af843d7d936c319b77f (patch)
tree49b0f7e78b6e298cc6c6956cbcedf3e9347e149d /novaclient
parentc4c44bcb2df01b77089139b267b1219008f9421e (diff)
downloadpython-novaclient-8f50f84981f354e0dbac0af843d7d936c319b77f.tar.gz
Bump to hacking 2.x
This is compatible with Python 3-only syntax. Change-Id: I462f4242b9a5f8d8cd6b0cb3d328dfd9d93ba200 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Diffstat (limited to 'novaclient')
-rw-r--r--novaclient/tests/functional/v2/test_servers.py2
-rw-r--r--novaclient/tests/unit/test_shell.py2
-rw-r--r--novaclient/tests/unit/utils.py1
-rw-r--r--novaclient/tests/unit/v2/test_shell.py2
-rw-r--r--novaclient/v2/shell.py9
5 files changed, 8 insertions, 8 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)