From 955afce5325ed2c7816cf0c3862ef947f4d09dbb Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Fri, 28 Jun 2019 11:31:59 +0000
Subject: [PATCH] SW-699: minor improvement

---
 LCS/Messaging/python/messaging/test/t_messagebus.py | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/LCS/Messaging/python/messaging/test/t_messagebus.py b/LCS/Messaging/python/messaging/test/t_messagebus.py
index c7fe2e84532..a7c7ebb440c 100644
--- a/LCS/Messaging/python/messaging/test/t_messagebus.py
+++ b/LCS/Messaging/python/messaging/test/t_messagebus.py
@@ -43,10 +43,6 @@ logger = logging.getLogger(__name__)
 
 TIMEOUT = 1.0
 
-if not can_connect_to_broker():
-    print("Cannot connect to default rabbitmq broker. Skipping test.")
-    exit(3)
-
 class TestCreateDeleteFunctions(unittest.TestCase):
     """Test the various create/delete exchange/queue/binding funcions"""
 
@@ -770,11 +766,8 @@ def load_tests(loader, tests, ignore):
 if __name__ == '__main__':
     logging.basicConfig(format='%(asctime)s %(thread)d %(threadName)s %(levelname)s %(message)s', level=logging.DEBUG)
 
-    try:
-        with ToBus():
-            pass
-    except Exception as e:
-        print("Cannot run %s. Error: %s" % (__file__, e))
+    if not can_connect_to_broker():
+        logger.error("Cannot connect to default rabbitmq broker. Skipping test.")
         exit(3)
 
     unittest.main()
-- 
GitLab