diff --git a/ironic/tests/unit/common/test_keystone.py b/ironic/tests/unit/common/test_keystone.py index 5f38c9f26c..93febd00e7 100644 --- a/ironic/tests/unit/common/test_keystone.py +++ b/ironic/tests/unit/common/test_keystone.py @@ -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') diff --git a/ironic/tests/unit/db/test_nodes.py b/ironic/tests/unit/db/test_nodes.py index 2c52dbeaa5..5f975b2f2a 100644 --- a/ironic/tests/unit/db/test_nodes.py +++ b/ironic/tests/unit/db/test_nodes.py @@ -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) diff --git a/ironic/tests/unit/drivers/modules/network/test_common.py b/ironic/tests/unit/drivers/modules/network/test_common.py index 0f75ca0f68..c43b00a73c 100644 --- a/ironic/tests/unit/drivers/modules/network/test_common.py +++ b/ironic/tests/unit/drivers/modules/network/test_common.py @@ -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') diff --git a/ironic/tests/unit/drivers/modules/network/test_neutron.py b/ironic/tests/unit/drivers/modules/network/test_neutron.py index f343f86e7f..e4cee72d4d 100644 --- a/ironic/tests/unit/drivers/modules/network/test_neutron.py +++ b/ironic/tests/unit/drivers/modules/network/test_neutron.py @@ -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()