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
if exp_range:
self.assertRaisesRegexp(exceptions.UnsupportedVersion,
".*range is '%s' to '%s'.*" %
(server_min, server_max),
api_versions.discover_version,
self.fake_client,
api_versions.APIVersion(requested_version))
self.assertRaisesRegex(exceptions.UnsupportedVersion,
".*range is '%s' to '%s'.*" %
(server_min, server_max),
api_versions.discover_version,
self.fake_client,
api_versions.APIVersion(requested_version))
else:
discovered_version = api_versions.discover_version(
self.fake_client,

View File

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