Replace assertRaisesRegexp with assertRaisesRegex

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

Closes-Bug: #1436957

Change-Id: I7e2eb18c1b5ecdd1691d7a51087b8a29ca152d89
This commit is contained in:
rajat29 2017-05-22 11:37:26 +05:30 committed by Rajat Sharma
parent 9e068bbc47
commit fc1ca5d2c5
5 changed files with 17 additions and 17 deletions

View File

@ -328,7 +328,7 @@ class BayModelManagerTest(testtools.TestCase):
def test_baymodel_create_fail(self):
CREATE_BAYMODEL_FAIL = copy.deepcopy(CREATE_BAYMODEL)
CREATE_BAYMODEL_FAIL["wrong_key"] = "wrong"
self.assertRaisesRegexp(exceptions.InvalidAttribute,
self.assertRaisesRegex(exceptions.InvalidAttribute,
("Key must be in %s" %
','.join(baymodels.CREATION_ATTRIBUTES)),
self.mgr.create, **CREATE_BAYMODEL_FAIL)

View File

@ -272,7 +272,7 @@ class BayManagerTest(testtools.TestCase):
def test_bay_create_fail(self):
CREATE_BAY_FAIL = copy.deepcopy(CREATE_BAY)
CREATE_BAY_FAIL["wrong_key"] = "wrong"
self.assertRaisesRegexp(exceptions.InvalidAttribute,
self.assertRaisesRegex(exceptions.InvalidAttribute,
("Key must be in %s" %
','.join(bays.CREATION_ATTRIBUTES)),
self.mgr.create, **CREATE_BAY_FAIL)

View File

@ -101,7 +101,7 @@ class CertificateManagerTest(testtools.TestCase):
def test_create_fail(self):
create_cert_fail = copy.deepcopy(CREATE_CERT)
create_cert_fail["wrong_key"] = "wrong"
self.assertRaisesRegexp(exceptions.InvalidAttribute,
self.assertRaisesRegex(exceptions.InvalidAttribute,
("Key must be in %s" %
','.join(certificates.CREATION_ATTRIBUTES)),
self.mgr.create, **create_cert_fail)

View File

@ -288,7 +288,7 @@ class ClusterManagerTest(testtools.TestCase):
def test_cluster_create_fail(self):
CREATE_CLUSTER_FAIL = copy.deepcopy(CREATE_CLUSTER)
CREATE_CLUSTER_FAIL["wrong_key"] = "wrong"
self.assertRaisesRegexp(exceptions.InvalidAttribute,
self.assertRaisesRegex(exceptions.InvalidAttribute,
("Key must be in %s" %
','.join(clusters.CREATION_ATTRIBUTES)),
self.mgr.create, **CREATE_CLUSTER_FAIL)

View File

@ -388,7 +388,7 @@ class ClusterTemplateManagerTest(testtools.TestCase):
def test_clustertemplate_create_fail(self):
CREATE_CLUSTERTEMPLATE_FAIL = copy.deepcopy(CREATE_CLUSTERTEMPLATE)
CREATE_CLUSTERTEMPLATE_FAIL["wrong_key"] = "wrong"
self.assertRaisesRegexp(
self.assertRaisesRegex(
exceptions.InvalidAttribute,
("Key must be in %s" %
','.join(cluster_templates.CREATION_ATTRIBUTES)),