Replace assertRaisesRegexp with assertRaisesRegex

This replaces the deprecated (in python 3.2) unittest.TestCase method
assertRaisesRegexp() with assertRaisesRegex().

Change-Id: I85025ad141f8436913ba192716435ce63e1e2d05
This commit is contained in:
zhangyangyang
2018-08-29 14:14:49 +08:00
parent b3487484d8
commit 3362a65085
2 changed files with 10 additions and 10 deletions

View File

@@ -236,12 +236,12 @@ class DiscoverVersionTestCase(utils.TestCase):
api_versions.MIN_VERSION = client_min api_versions.MIN_VERSION = client_min
if exp_range: if exp_range:
self.assertRaisesRegexp(exceptions.UnsupportedVersion, self.assertRaisesRegex(exceptions.UnsupportedVersion,
".*range is '%s' to '%s'.*" % ".*range is '%s' to '%s'.*" %
(server_min, server_max), (server_min, server_max),
api_versions.discover_version, api_versions.discover_version,
self.fake_client, self.fake_client,
api_versions.APIVersion(requested_version)) api_versions.APIVersion(requested_version))
else: else:
discovered_version = api_versions.discover_version( discovered_version = api_versions.discover_version(
self.fake_client, self.fake_client,

View File

@@ -529,10 +529,10 @@ class ShellTest(utils.TestCase):
def test_rename_invalid_args(self): def test_rename_invalid_args(self):
"""Ensure that error generated does not reference an HTTP code.""" """Ensure that error generated does not reference an HTTP code."""
self.assertRaisesRegexp(exceptions.ClientException, self.assertRaisesRegex(exceptions.ClientException,
'(?!HTTP)', '(?!HTTP)',
self.run_command, self.run_command,
'rename volume-1234-abcd') 'rename volume-1234-abcd')
def test_rename_snapshot(self): def test_rename_snapshot(self):
# basic rename with positional arguments # basic rename with positional arguments