diff --git a/LCS/Messaging/python/messaging/test/t_messagebus.py b/LCS/Messaging/python/messaging/test/t_messagebus.py index 68a454f9cfc404ecbb92ed2390a358c10678155a..1e861c17b3e531d76458c0f750fa24f518d1df63 100644 --- a/LCS/Messaging/python/messaging/test/t_messagebus.py +++ b/LCS/Messaging/python/messaging/test/t_messagebus.py @@ -171,11 +171,18 @@ class ToBusInitFailed(unittest.TestCase): """ Connecting to broker on wrong port must raise MessageBusError """ + # Cache and disable auto reconnect + old_reconnect = DEFAULT_BROKER_OPTIONS.get('reconnect', False) + DEFAULT_BROKER_OPTIONS['reconnect'] = False + regexp = re.escape(self.error) + '.*' + 'Connection refused' with self.assertRaisesRegexp(MessageBusError, regexp): with ToBus(QUEUE, broker="localhost:4"): pass + # Restore auto reconnect + DEFAULT_BROKER_OPTIONS['reconnect'] = old_reconnect + class ToBusSendMessage(unittest.TestCase): """