diff options
| author | songwenping <songwenping@inspur.com> | 2020-10-06 14:26:27 +0800 |
|---|---|---|
| committer | root <songwenping@inspur.com> | 2020-10-07 02:15:25 +0000 |
| commit | c2df9215e19752714e83fcad82c8ae3708f85d7a (patch) | |
| tree | cfcf7e7041dcb4e4532a645d087140053bc5deca /openstackclient/tests/unit/compute | |
| parent | 098a3fe2dea70eb16f13b717d62f51a4c890891d (diff) | |
| download | python-openstackclient-c2df9215e19752714e83fcad82c8ae3708f85d7a.tar.gz | |
Remove usage of six
With python3.x, classes can use 'metaclass=' instead of
'six.add_metaclass', 'six.iteritems' and 'six.iterkeys' can
be replaced by 'items' and 'keys', 'six.moves.urllib.parse'
can be replaced by 'urllib.parse', 'six.StringIO' and
'six.moves.cStringIO' can be replaced by 'io.StringIO',
'six.text_type' and 'six.string_type' are just 'str'.
Change-Id: I84848c0bf8ab3c36dd821141191e2725e4e3b58b
Diffstat (limited to 'openstackclient/tests/unit/compute')
| -rw-r--r-- | openstackclient/tests/unit/compute/v2/test_server.py | 15 | ||||
| -rw-r--r-- | openstackclient/tests/unit/compute/v2/test_service.py | 5 |
2 files changed, 9 insertions, 11 deletions
diff --git a/openstackclient/tests/unit/compute/v2/test_server.py b/openstackclient/tests/unit/compute/v2/test_server.py index 02bb406c..2445e143 100644 --- a/openstackclient/tests/unit/compute/v2/test_server.py +++ b/openstackclient/tests/unit/compute/v2/test_server.py @@ -24,7 +24,6 @@ from openstack import exceptions as sdk_exceptions from osc_lib import exceptions from osc_lib import utils as common_utils from oslo_utils import timeutils -import six from openstackclient.compute.v2 import server from openstackclient.tests.unit.compute.v2 import fakes as compute_fakes @@ -1907,7 +1906,7 @@ class TestServerCreate(TestServer): self.cmd.take_action, parsed_args) # Assert it is the error we expect. self.assertIn('--volume is not allowed with --boot-from-volume', - six.text_type(ex)) + str(ex)) def test_server_create_image_property(self): arglist = [ @@ -3288,7 +3287,7 @@ class TestServerMigrate(TestServer): # Make sure it's the error we expect. self.assertIn('--os-compute-api-version 2.56 or greater is required ' 'to use --host without --live-migration.', - six.text_type(ex)) + str(ex)) self.servers_mock.get.assert_called_with(self.server.id) self.assertNotCalled(self.servers_mock.live_migrate) @@ -3323,7 +3322,7 @@ class TestServerMigrate(TestServer): # A warning should have been logged for using --live. mock_warning.assert_called_once() self.assertIn('The --live option has been deprecated.', - six.text_type(mock_warning.call_args[0][0])) + str(mock_warning.call_args[0][0])) def test_server_live_migrate_host_pre_2_30(self): # Tests that the --host option is not supported for --live-migration @@ -3346,7 +3345,7 @@ class TestServerMigrate(TestServer): # Make sure it's the error we expect. self.assertIn('--os-compute-api-version 2.30 or greater is required ' - 'when using --host', six.text_type(ex)) + 'when using --host', str(ex)) self.servers_mock.get.assert_called_with(self.server.id) self.assertNotCalled(self.servers_mock.live_migrate) @@ -3436,7 +3435,7 @@ class TestServerMigrate(TestServer): # A warning should have been logged for using --live. mock_warning.assert_called_once() self.assertIn('The --live option has been deprecated.', - six.text_type(mock_warning.call_args[0][0])) + str(mock_warning.call_args[0][0])) def test_server_live_migrate_live_and_host_mutex(self): # Tests specifying both the --live and --host options which are in a @@ -4352,7 +4351,7 @@ class TestServerResize(TestServer): # A warning should have been logged for using --confirm. mock_warning.assert_called_once() self.assertIn('The --confirm option has been deprecated.', - six.text_type(mock_warning.call_args[0][0])) + str(mock_warning.call_args[0][0])) def test_server_resize_revert(self): arglist = [ @@ -4377,7 +4376,7 @@ class TestServerResize(TestServer): # A warning should have been logged for using --revert. mock_warning.assert_called_once() self.assertIn('The --revert option has been deprecated.', - six.text_type(mock_warning.call_args[0][0])) + str(mock_warning.call_args[0][0])) @mock.patch.object(common_utils, 'wait_for_status', return_value=True) def test_server_resize_with_wait_ok(self, mock_wait_for_status): diff --git a/openstackclient/tests/unit/compute/v2/test_service.py b/openstackclient/tests/unit/compute/v2/test_service.py index 7a036833..87e54747 100644 --- a/openstackclient/tests/unit/compute/v2/test_service.py +++ b/openstackclient/tests/unit/compute/v2/test_service.py @@ -18,7 +18,6 @@ from unittest.mock import call from novaclient import api_versions from osc_lib import exceptions -import six from openstackclient.compute.v2 import service from openstackclient.tests.unit.compute.v2 import fakes as compute_fakes @@ -502,7 +501,7 @@ class TestServiceSet(TestService): self.cmd._find_service_by_host_and_binary, self.service_mock, 'fake-host', 'nova-compute') self.assertIn('Compute service for host "fake-host" and binary ' - '"nova-compute" not found.', six.text_type(ex)) + '"nova-compute" not found.', str(ex)) def test_service_set_find_service_by_host_and_binary_many_results(self): # Tests that more than one compute service is found by host and binary. @@ -512,4 +511,4 @@ class TestServiceSet(TestService): self.service_mock, 'fake-host', 'nova-compute') self.assertIn('Multiple compute services found for host "fake-host" ' 'and binary "nova-compute". Unable to proceed.', - six.text_type(ex)) + str(ex)) |
