From ca7a46b113c64edd87bfa7b9f56fdb97a0c96dd6 Mon Sep 17 00:00:00 2001 From: Riccardo Pittau Date: Thu, 28 Nov 2019 17:10:40 +0100 Subject: Stop using six library Since we've dropped support for Python 2.7, it's time to look at the bright future that Python 3.x will bring and stop forcing compatibility with older versions. This patch removes the six library from requirements, not looking back. Change-Id: I4795417aa649be75ba7162a8cf30eacbb88c7b5e --- ironic_python_agent/tests/unit/test_utils.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'ironic_python_agent/tests/unit/test_utils.py') diff --git a/ironic_python_agent/tests/unit/test_utils.py b/ironic_python_agent/tests/unit/test_utils.py index 4ee0ebd3..5b313846 100644 --- a/ironic_python_agent/tests/unit/test_utils.py +++ b/ironic_python_agent/tests/unit/test_utils.py @@ -26,7 +26,6 @@ from ironic_lib import utils as ironic_utils import mock from oslo_concurrency import processutils from oslo_serialization import base64 -import six import testtools from ironic_python_agent import errors @@ -52,13 +51,13 @@ class ExecuteTestCase(ironic_agent_base.IronicAgentTest): class GetAgentParamsTestCase(ironic_agent_base.IronicAgentTest): @mock.patch('oslo_log.log.getLogger', autospec=True) - @mock.patch('six.moves.builtins.open', autospec=True) + @mock.patch('builtins.open', autospec=True) def test__read_params_from_file_fail(self, logger_mock, open_mock): open_mock.side_effect = Exception params = utils._read_params_from_file('file-path') self.assertEqual({}, params) - @mock.patch('six.moves.builtins.open', autospec=True) + @mock.patch('builtins.open', autospec=True) def test__read_params_from_file(self, open_mock): kernel_line = 'api-url=http://localhost:9999 baz foo=bar\n' open_mock.return_value.__enter__ = lambda s: s @@ -118,7 +117,7 @@ class GetAgentParamsTestCase(ironic_agent_base.IronicAgentTest): self.assertEqual(expected_params, returned_params) self.assertEqual(0, set_cache_mock.call_count) - @mock.patch('six.moves.builtins.open', autospec=True) + @mock.patch('builtins.open', autospec=True) @mock.patch.object(glob, 'glob', autospec=True) def test__get_vmedia_device(self, glob_mock, open_mock): @@ -392,7 +391,7 @@ class TestUtils(testtools.TestCase): contents = b'Squidward Tentacles' io_dict = {'fake-name': io.BytesIO(bytes(contents))} data = utils.gzip_and_b64encode(io_dict=io_dict) - self.assertIsInstance(data, six.text_type) + self.assertIsInstance(data, str) res = io.BytesIO(base64.decode_as_bytes(data)) with tarfile.open(fileobj=res) as tar: -- cgit v1.2.1