summaryrefslogtreecommitdiff
path: root/cinderclient/tests/functional
diff options
context:
space:
mode:
authorhaixin <haixin@inspur.com>2020-09-30 10:40:31 +0800
committerhaixin <haixin@inspur.com>2021-03-04 16:03:35 +0800
commitcea1f674ae1ce545c0cac209b423ac9d626f0c68 (patch)
tree115ce0356744e48f37678f56220a754f6c066daa /cinderclient/tests/functional
parent1abc1b5d404c523a696f7186bc4c4b6fc7407cad (diff)
downloadpython-cinderclient-cea1f674ae1ce545c0cac209b423ac9d626f0c68.tar.gz
Remove all usage of six library
Replace six with Python 3 style code. Change-Id: I4b97e040f3e790ac114dcd43c68e6b67b1079adf
Diffstat (limited to 'cinderclient/tests/functional')
-rw-r--r--cinderclient/tests/functional/base.py6
-rw-r--r--cinderclient/tests/functional/test_snapshot_create_cli.py4
-rw-r--r--cinderclient/tests/functional/test_volume_create_cli.py9
-rw-r--r--cinderclient/tests/functional/test_volume_extend_cli.py12
4 files changed, 13 insertions, 18 deletions
diff --git a/cinderclient/tests/functional/base.py b/cinderclient/tests/functional/base.py
index 3d2e2f8..2f03475 100644
--- a/cinderclient/tests/functional/base.py
+++ b/cinderclient/tests/functional/base.py
@@ -10,10 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+import configparser
import os
import time
-import six
from tempest.lib.cli import base
from tempest.lib.cli import output_parser
from tempest.lib import exceptions
@@ -38,7 +38,7 @@ def credentials():
os.environ.get('OS_PROJECT_NAME'))
auth_url = os.environ.get('OS_AUTH_URL')
- config = six.moves.configparser.RawConfigParser()
+ config = configparser.RawConfigParser()
if config.read(_CREDS_FILE):
username = username or config.get('admin', 'user')
password = password or config.get('admin', 'pass')
@@ -101,7 +101,7 @@ class ClientTestBase(base.ClientTestBase):
obj = {}
items = self.parser.listing(output)
for item in items:
- obj[item['Property']] = six.text_type(item['Value'])
+ obj[item['Property']] = str(item['Value'])
return obj
def object_cmd(self, object_name, cmd):
diff --git a/cinderclient/tests/functional/test_snapshot_create_cli.py b/cinderclient/tests/functional/test_snapshot_create_cli.py
index 7ef5dfd..4c0bd12 100644
--- a/cinderclient/tests/functional/test_snapshot_create_cli.py
+++ b/cinderclient/tests/functional/test_snapshot_create_cli.py
@@ -10,7 +10,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
-import six
+
from cinderclient.tests.functional import base
@@ -47,7 +47,7 @@ class CinderSnapshotTests(base.ClientTestBase):
'snapshot',
params='--metadata test_metadata=test_date {0}'.format(
self.volume['id']))
- self.assertEqual(six.text_type({u'test_metadata': u'test_date'}),
+ self.assertEqual(str({'test_metadata': 'test_date'}),
snapshot['metadata'])
self.object_delete('snapshot', snapshot['id'])
self.check_object_deleted('snapshot', snapshot['id'])
diff --git a/cinderclient/tests/functional/test_volume_create_cli.py b/cinderclient/tests/functional/test_volume_create_cli.py
index deae383..9c9fc0d 100644
--- a/cinderclient/tests/functional/test_volume_create_cli.py
+++ b/cinderclient/tests/functional/test_volume_create_cli.py
@@ -11,7 +11,6 @@
# under the License.
import ddt
-import six
from tempest.lib import exceptions
from cinderclient.tests.functional import base
@@ -32,9 +31,9 @@ class CinderVolumeNegativeTests(base.ClientTestBase):
)
@ddt.unpack
def test_volume_create_with_incorrect_size(self, value, ex_text):
-
- six.assertRaisesRegex(self, exceptions.CommandFailed, ex_text,
- self.object_create, 'volume', params=value)
+ self.assertRaisesRegex(exceptions.CommandFailed,
+ ex_text, self.object_create,
+ 'volume', params=value)
class CinderVolumeTests(base.ClientTestBase):
@@ -96,5 +95,5 @@ class CinderVolumeTestsWithParameters(base.ClientTestBase):
"""
volume = self.object_create(
'volume', params='--metadata test_metadata=test_date 1')
- self.assertEqual(six.text_type({u'test_metadata': u'test_date'}),
+ self.assertEqual(str({'test_metadata': 'test_date'}),
volume['metadata'])
diff --git a/cinderclient/tests/functional/test_volume_extend_cli.py b/cinderclient/tests/functional/test_volume_extend_cli.py
index 8dd557a..6a5c99c 100644
--- a/cinderclient/tests/functional/test_volume_extend_cli.py
+++ b/cinderclient/tests/functional/test_volume_extend_cli.py
@@ -11,8 +11,6 @@
# under the License.
import ddt
-import six
-
from tempest.lib import exceptions
from cinderclient.tests.functional import base
@@ -39,9 +37,8 @@ class CinderVolumeExtendNegativeTests(base.ClientTestBase):
)
@ddt.unpack
def test_volume_extend_with_incorrect_size(self, value, ex_text):
-
- six.assertRaisesRegex(
- self, exceptions.CommandFailed, ex_text, self.cinder, 'extend',
+ self.assertRaisesRegex(
+ exceptions.CommandFailed, ex_text, self.cinder, 'extend',
params='{0} {1}'.format(self.volume['id'], value))
@ddt.data(
@@ -52,7 +49,6 @@ class CinderVolumeExtendNegativeTests(base.ClientTestBase):
)
@ddt.unpack
def test_volume_extend_with_incorrect_volume_id(self, value, ex_text):
-
- six.assertRaisesRegex(
- self, exceptions.CommandFailed, ex_text, self.cinder, 'extend',
+ self.assertRaisesRegex(
+ exceptions.CommandFailed, ex_text, self.cinder, 'extend',
params='{0} 2'.format(value))