diff options
author | Zuul <zuul@review.opendev.org> | 2020-07-16 21:25:14 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2020-07-16 21:25:14 +0000 |
commit | dca62b4de1a366a869ff9feb88dbb830e1055b7b (patch) | |
tree | 25ce7069e62ffc23ff73ccc34406db6ad9203f17 /glanceclient/tests/unit/v1/test_shell.py | |
parent | 3cd06f763fdb2c2ee233cb8167aadb5f29000d97 (diff) | |
parent | 928935e5c0b8b43827fdf08b212d59d92b660924 (diff) | |
download | python-glanceclient-dca62b4de1a366a869ff9feb88dbb830e1055b7b.tar.gz |
Merge "Do not use the six library in the tests."
Diffstat (limited to 'glanceclient/tests/unit/v1/test_shell.py')
-rw-r--r-- | glanceclient/tests/unit/v1/test_shell.py | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/glanceclient/tests/unit/v1/test_shell.py b/glanceclient/tests/unit/v1/test_shell.py index 5476a2f..46c6f68 100644 --- a/glanceclient/tests/unit/v1/test_shell.py +++ b/glanceclient/tests/unit/v1/test_shell.py @@ -15,11 +15,11 @@ # under the License. import argparse +import io import json import os from unittest import mock -import six import subprocess import tempfile import testtools @@ -34,12 +34,6 @@ import glanceclient.v1.shell as v1shell from glanceclient.tests import utils -if six.PY3: - import io - file_type = io.IOBase -else: - file_type = file - fixtures = { '/v1/images/96d2c7e1-de4e-4612-8aa2-ba26610c804e': { 'PUT': ( @@ -351,7 +345,7 @@ class ShellInvalidEndpointandParameterTest(utils.TestCase): @mock.patch('sys.stderr') def test_image_create_missing_container_format_stdin_data(self, __): # Fake that get_data_file method returns data - self.mock_get_data_file.return_value = six.StringIO() + self.mock_get_data_file.return_value = io.StringIO() e = self.assertRaises(exc.CommandError, self.run_command, '--os-image-api-version 1 image-create' ' --disk-format qcow2') @@ -361,7 +355,7 @@ class ShellInvalidEndpointandParameterTest(utils.TestCase): @mock.patch('sys.stderr') def test_image_create_missing_disk_format_stdin_data(self, __): # Fake that get_data_file method returns data - self.mock_get_data_file.return_value = six.StringIO() + self.mock_get_data_file.return_value = io.StringIO() e = self.assertRaises(exc.CommandError, self.run_command, '--os-image-api-version 1 image-create' ' --container-format bare') @@ -574,7 +568,7 @@ class ShellStdinHandlingTests(testtools.TestCase): self._do_update('44d2c7e1-de4e-4612-8aa2-ba26610c444f') self.assertIn('data', self.collected_args[1]) - self.assertIsInstance(self.collected_args[1]['data'], file_type) + self.assertIsInstance(self.collected_args[1]['data'], io.IOBase) self.assertEqual(b'Some Data', self.collected_args[1]['data'].read()) @@ -599,7 +593,7 @@ class ShellStdinHandlingTests(testtools.TestCase): self._do_update('44d2c7e1-de4e-4612-8aa2-ba26610c444f') self.assertIn('data', self.collected_args[1]) - self.assertIsInstance(self.collected_args[1]['data'], file_type) + self.assertIsInstance(self.collected_args[1]['data'], io.IOBase) self.assertEqual(b'Some Data\n', self.collected_args[1]['data'].read()) |