Replace assertRaisesRegexp with assertRaisesRegex
This replaces the deprecated (in python 3.2) unittest.TestCase method assertRaisesRegexp() with assertRaisesRegex() Change-Id: I98945eeb3e432b9b63deeaeac193585a601b671e
This commit is contained in:
parent
851b075b6e
commit
ec6a695a32
@ -169,7 +169,7 @@ class TestHealthDaemon(base.TestCase):
|
||||
mock_build_msg.side_effect = ['TEST', Exception('break')]
|
||||
|
||||
test_queue = queue.Queue()
|
||||
self.assertRaisesRegexp(Exception, 'break',
|
||||
self.assertRaisesRegex(Exception, 'break',
|
||||
health_daemon.run_sender, test_queue)
|
||||
|
||||
sender_mock.dosend.assert_called_once_with('TEST')
|
||||
@ -178,7 +178,7 @@ class TestHealthDaemon(base.TestCase):
|
||||
mock_build_msg.reset_mock()
|
||||
mock_build_msg.side_effect = ['TEST', Exception('break')]
|
||||
test_queue.put('reload')
|
||||
self.assertRaisesRegexp(Exception, 'break',
|
||||
self.assertRaisesRegex(Exception, 'break',
|
||||
health_daemon.run_sender, test_queue)
|
||||
mock_reload_cfg.assert_called_once_with()
|
||||
|
||||
@ -195,7 +195,7 @@ class TestHealthDaemon(base.TestCase):
|
||||
mock_build_msg.reset_mock()
|
||||
mock_build_msg.side_effect = ['TEST', Exception('break')]
|
||||
test_queue.put('bogus')
|
||||
self.assertRaisesRegexp(Exception, 'break',
|
||||
self.assertRaisesRegex(Exception, 'break',
|
||||
health_daemon.run_sender, test_queue)
|
||||
|
||||
@mock.patch('octavia.amphorae.backends.utils.haproxy_query.HAProxyQuery')
|
||||
|
@ -80,7 +80,7 @@ class QueryTestCase(base.TestCase):
|
||||
sock.recv.assert_called_with(1024)
|
||||
self.assertTrue(sock.close.called)
|
||||
|
||||
self.assertRaisesRegexp(Exception,
|
||||
self.assertRaisesRegex(Exception,
|
||||
'HAProxy \'test\' query failed.',
|
||||
self.q._query, 'test')
|
||||
|
||||
|
@ -31,7 +31,7 @@ class TestHAproxyVRRPCheckCMD(base.TestCase):
|
||||
recv_mock.side_effect = [b'1', Exception('BREAK')]
|
||||
socket_mock.recv = recv_mock
|
||||
|
||||
self.assertRaisesRegexp(Exception, 'BREAK',
|
||||
self.assertRaisesRegex(Exception, 'BREAK',
|
||||
haproxy_vrrp_check.health_check,
|
||||
'10.0.0.1')
|
||||
|
||||
|
@ -35,7 +35,7 @@ class TestHealthManagerCMD(base.TestCase):
|
||||
getter_mock.check = check_mock
|
||||
getter_mock.check.side_effect = [None, Exception('break')]
|
||||
mock_getter.return_value = getter_mock
|
||||
self.assertRaisesRegexp(Exception, 'break',
|
||||
self.assertRaisesRegex(Exception, 'break',
|
||||
health_manager.hm_listener)
|
||||
mock_getter.assert_called_once_with(mock_health(), mock_stats())
|
||||
self.assertEqual(2, getter_mock.check.call_count)
|
||||
@ -48,7 +48,7 @@ class TestHealthManagerCMD(base.TestCase):
|
||||
hm_mock.health_check = health_check_mock
|
||||
hm_mock.health_check.side_effect = [None, Exception('break')]
|
||||
mock_health.return_value = hm_mock
|
||||
self.assertRaisesRegexp(Exception, 'break',
|
||||
self.assertRaisesRegex(Exception, 'break',
|
||||
health_manager.hm_health_check)
|
||||
mock_health.assert_called_once_with()
|
||||
self.assertEqual(2, hm_mock.health_check.call_count)
|
||||
|
@ -37,7 +37,7 @@ class TestHouseKeepingCMD(base.TestCase):
|
||||
spare_amp_thread_event_mock.is_set.side_effect = [False,
|
||||
Exception('break')]
|
||||
|
||||
self.assertRaisesRegexp(Exception, 'break',
|
||||
self.assertRaisesRegex(Exception, 'break',
|
||||
house_keeping.spare_amphora_check)
|
||||
|
||||
mock_SpareAmphora.assert_called_once_with()
|
||||
@ -57,7 +57,7 @@ class TestHouseKeepingCMD(base.TestCase):
|
||||
db_cleanup_event_mock.is_set = mock.MagicMock()
|
||||
db_cleanup_event_mock.is_set.side_effect = [False, Exception('break')]
|
||||
|
||||
self.assertRaisesRegexp(Exception, 'break', house_keeping.db_cleanup)
|
||||
self.assertRaisesRegex(Exception, 'break', house_keeping.db_cleanup)
|
||||
|
||||
mock_DatabaseCleanup.assert_called_once_with()
|
||||
self.assertEqual(1, db_cleanup.delete_old_amphorae.call_count)
|
||||
@ -80,7 +80,7 @@ class TestHouseKeepingCMD(base.TestCase):
|
||||
cert_rotate_event_mock.is_set = mock.MagicMock()
|
||||
cert_rotate_event_mock.is_set.side_effect = [False, Exception('break')]
|
||||
|
||||
self.assertRaisesRegexp(Exception, 'break',
|
||||
self.assertRaisesRegex(Exception, 'break',
|
||||
house_keeping.cert_rotation)
|
||||
|
||||
mock_CertRotation.assert_called_once_with()
|
||||
@ -134,7 +134,7 @@ class TestHouseKeepingCMD(base.TestCase):
|
||||
|
||||
# mock the time.sleep() in the while loop
|
||||
sleep_time.side_effect = [True, Exception('break')]
|
||||
self.assertRaisesRegexp(Exception, 'break', house_keeping.main)
|
||||
self.assertRaisesRegex(Exception, 'break', house_keeping.main)
|
||||
|
||||
spare_amp_thread_mock.start.assert_called_once_with()
|
||||
db_cleanup_thread_mock.start.assert_called_once_with()
|
||||
|
Loading…
Reference in New Issue
Block a user