diff options
| author | Zuul <zuul@review.opendev.org> | 2020-10-09 19:37:48 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2020-10-09 19:37:48 +0000 |
| commit | a48c05b90a376ce33e2f0a2d321b8c851a6ef0b0 (patch) | |
| tree | da430ebd4695049d4fdc06b8892f7103d6b0f5cc /openstackclient/tests/unit | |
| parent | 960004dcc733e88841d372e160b9e43669796c80 (diff) | |
| parent | c2df9215e19752714e83fcad82c8ae3708f85d7a (diff) | |
| download | python-openstackclient-a48c05b90a376ce33e2f0a2d321b8c851a6ef0b0.tar.gz | |
Merge "Remove usage of six"
Diffstat (limited to 'openstackclient/tests/unit')
| -rw-r--r-- | openstackclient/tests/unit/compute/v2/test_server.py | 15 | ||||
| -rw-r--r-- | openstackclient/tests/unit/compute/v2/test_service.py | 5 | ||||
| -rw-r--r-- | openstackclient/tests/unit/fakes.py | 3 | ||||
| -rw-r--r-- | openstackclient/tests/unit/object/v1/fakes.py | 3 | ||||
| -rw-r--r-- | openstackclient/tests/unit/object/v1/test_object_all.py | 6 | ||||
| -rw-r--r-- | openstackclient/tests/unit/utils.py | 2 |
6 files changed, 15 insertions, 19 deletions
diff --git a/openstackclient/tests/unit/compute/v2/test_server.py b/openstackclient/tests/unit/compute/v2/test_server.py index dffedc6d..59282b4a 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 @@ -1908,7 +1907,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 = [ @@ -3289,7 +3288,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) @@ -3324,7 +3323,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 @@ -3347,7 +3346,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) @@ -3437,7 +3436,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 @@ -4353,7 +4352,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 = [ @@ -4378,7 +4377,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)) diff --git a/openstackclient/tests/unit/fakes.py b/openstackclient/tests/unit/fakes.py index e5476f06..00e0c129 100644 --- a/openstackclient/tests/unit/fakes.py +++ b/openstackclient/tests/unit/fakes.py @@ -19,7 +19,6 @@ from unittest import mock from keystoneauth1 import fixture import requests -import six AUTH_TOKEN = "foobar" @@ -253,7 +252,7 @@ class FakeResponse(requests.Response): self.headers.update(headers) self._content = json.dumps(data) - if not isinstance(self._content, six.binary_type): + if not isinstance(self._content, bytes): self._content = self._content.encode() diff --git a/openstackclient/tests/unit/object/v1/fakes.py b/openstackclient/tests/unit/object/v1/fakes.py index 0ed791a5..1808d5b7 100644 --- a/openstackclient/tests/unit/object/v1/fakes.py +++ b/openstackclient/tests/unit/object/v1/fakes.py @@ -14,7 +14,6 @@ # from keystoneauth1 import session -import six from openstackclient.api import object_store_v1 as object_store from openstackclient.tests.unit import utils @@ -68,7 +67,7 @@ OBJECT = { 'last_modified': object_modified_1, } -object_1_content = six.b('object 1 content') +object_1_content = b'object 1 content' OBJECT_2 = { 'name': object_name_2, diff --git a/openstackclient/tests/unit/object/v1/test_object_all.py b/openstackclient/tests/unit/object/v1/test_object_all.py index dd587142..7e88409f 100644 --- a/openstackclient/tests/unit/object/v1/test_object_all.py +++ b/openstackclient/tests/unit/object/v1/test_object_all.py @@ -12,11 +12,11 @@ # import copy +import io from unittest import mock from osc_lib import exceptions from requests_mock.contrib import fixture -import six from openstackclient.object.v1 import object as object_cmds from openstackclient.tests.unit.object.v1 import fakes as object_fakes @@ -241,9 +241,9 @@ class TestObjectSave(TestObjectAll): parsed_args = self.check_parser(self.cmd, arglist, verifylist) - class FakeStdout(six.BytesIO): + class FakeStdout(io.BytesIO): def __init__(self): - six.BytesIO.__init__(self) + io.BytesIO.__init__(self) self.context_manager_calls = [] def __enter__(self): diff --git a/openstackclient/tests/unit/utils.py b/openstackclient/tests/unit/utils.py index 4f1bc46a..4130f18e 100644 --- a/openstackclient/tests/unit/utils.py +++ b/openstackclient/tests/unit/utils.py @@ -14,11 +14,11 @@ # under the License. # +from io import StringIO import os from cliff import columns as cliff_columns import fixtures -from six.moves import StringIO import testtools from openstackclient.tests.unit import fakes |
