Replace deprecated .assertRaisesRegexp()
This replaces the deprecated (in python 3.2) unittest.TestCase method assertRaisesRegexp() with assertRaisesRegex(). Change-Id: Iec0f38102a76f4830ba1a96ed06743072048285f Related-Bug: 1673768
This commit is contained in:
parent
864d39d350
commit
1dc033f6b3
|
@ -95,10 +95,9 @@ class KeystoneTestCase(base.TestCase):
|
|||
@mock.patch.object(keystone, '_get_legacy_auth', return_value=None)
|
||||
@mock.patch.object(ironic_auth, 'load_auth', return_value=None)
|
||||
def test_get_session_fail(self, auth_get_mock, legacy_get_mock):
|
||||
self.assertRaisesRegexp(
|
||||
exception.KeystoneFailure,
|
||||
"Failed to load auth from either",
|
||||
keystone.get_session, self.test_group)
|
||||
self.assertRaisesRegex(exception.KeystoneFailure,
|
||||
"Failed to load auth from either",
|
||||
keystone.get_session, self.test_group)
|
||||
|
||||
@mock.patch('keystoneauth1.loading.load_auth_from_conf_options')
|
||||
@mock.patch('ironic.common.keystone._get_legacy_auth')
|
||||
|
|
|
@ -632,10 +632,10 @@ class DbNodeTestCase(base.DbTestCase):
|
|||
node_id=node.id,
|
||||
address='aa:bb:cc:dd:ee:ff')
|
||||
|
||||
self.assertRaisesRegexp(exception.NodeNotFound,
|
||||
'was not found',
|
||||
self.dbapi.get_node_by_port_addresses,
|
||||
['11:22:33:44:55:66'])
|
||||
self.assertRaisesRegex(exception.NodeNotFound,
|
||||
'was not found',
|
||||
self.dbapi.get_node_by_port_addresses,
|
||||
['11:22:33:44:55:66'])
|
||||
|
||||
def test_get_node_by_port_addresses_multiple_found(self):
|
||||
node1 = utils.create_test_node(
|
||||
|
@ -652,7 +652,7 @@ class DbNodeTestCase(base.DbTestCase):
|
|||
node_id=node2.id,
|
||||
address=addresses[1])
|
||||
|
||||
self.assertRaisesRegexp(exception.NodeNotFound,
|
||||
'Multiple nodes',
|
||||
self.dbapi.get_node_by_port_addresses,
|
||||
addresses)
|
||||
self.assertRaisesRegex(exception.NodeNotFound,
|
||||
'Multiple nodes',
|
||||
self.dbapi.get_node_by_port_addresses,
|
||||
addresses)
|
||||
|
|
|
@ -372,7 +372,7 @@ class TestVifPortIDMixin(db_base.DbTestCase):
|
|||
mock_upa.side_effect = (
|
||||
exception.FailedToUpdateMacOnPort(port_id='fake'))
|
||||
with task_manager.acquire(self.context, self.node.id) as task:
|
||||
self.assertRaisesRegexp(
|
||||
self.assertRaisesRegex(
|
||||
exception.NetworkError, "can not update Neutron port",
|
||||
self.interface.vif_attach, task, vif)
|
||||
mock_client.assert_called_once_with()
|
||||
|
@ -447,7 +447,7 @@ class TestVifPortIDMixin(db_base.DbTestCase):
|
|||
|
||||
def test_vif_detach_not_attached(self):
|
||||
with task_manager.acquire(self.context, self.node.id) as task:
|
||||
self.assertRaisesRegexp(
|
||||
self.assertRaisesRegex(
|
||||
exception.VifNotAttached, "it is not attached to it.",
|
||||
self.interface.vif_detach, task, 'aaa')
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ class NeutronInterfaceTestCase(db_base.DbTestCase):
|
|||
n = utils.create_test_node(self.context, network_interface='neutron',
|
||||
uuid=uuidutils.generate_uuid())
|
||||
with task_manager.acquire(self.context, n.id) as task:
|
||||
self.assertRaisesRegexp(
|
||||
self.assertRaisesRegex(
|
||||
exception.NetworkError, 'No ports are associated',
|
||||
self.interface.configure_tenant_networks, task)
|
||||
|
||||
|
@ -277,7 +277,7 @@ class NeutronInterfaceTestCase(db_base.DbTestCase):
|
|||
client.update_port.side_effect = neutron_exceptions.ConnectionFailed(
|
||||
reason='meow')
|
||||
with task_manager.acquire(self.context, self.node.id) as task:
|
||||
self.assertRaisesRegexp(
|
||||
self.assertRaisesRegex(
|
||||
exception.NetworkError, 'Could not add',
|
||||
self.interface.configure_tenant_networks, task)
|
||||
client_mock.assert_called_once_with()
|
||||
|
|
Loading…
Reference in New Issue