This is an automated email from the ASF dual-hosted git repository.

jdanek pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git

commit ee48041310b5dfb4e42bd1b865ed4f435c89eb37
Author: Jiri Danek <jda...@redhat.com>
AuthorDate: Fri Jul 23 13:10:41 2021 +0200

    DISPATCH-2098 Skip the entire websockets test class if deps are missing
    
    This fixes failure to dispose with the router in the correct way upon 
individual test skip on macOS.
---
 tests/system_tests_websockets.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tests/system_tests_websockets.py b/tests/system_tests_websockets.py
index 613f9fa..d9b5854 100644
--- a/tests/system_tests_websockets.py
+++ b/tests/system_tests_websockets.py
@@ -17,12 +17,19 @@
 # under the License
 #
 
+import asyncio
 import unittest
 
+try:
+    import websockets
+except ImportError:
+    websockets = None
+
 from system_test import Qdrouterd
 from system_test import main_module, TestCase, Process
 
 
+@unittest.skipIf(websockets is None, "python test requirement package 
`websockets` is missing")
 class WebsocketsConsoleTest(TestCase):
     """Run websockets tests connecting to the console"""
 
@@ -43,11 +50,6 @@ class WebsocketsConsoleTest(TestCase):
         """Verify the shutdown sequence works when a client is connected to a 
websocket port.
 
         Previously, this was broken in DISPATCH-857, DISPATCH-945, 
DISPATCH-2098"""
-        import asyncio
-        try:
-            import websockets
-        except ImportError:
-            self.skipTest("python test requirement package `websockets` is 
missing")
 
         async def run():
             uri = f"ws://localhost:{self.http_port}"

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to