From ae973576755a4548741f2576b40cf74c1b6a61be Mon Sep 17 00:00:00 2001 From: tsm-odoo Date: Wed, 24 Aug 2022 08:06:52 +0000 Subject: [PATCH] [FIX] bus: websocket module import MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The websocket client library is used during tests but is not in requirements.txt. Therefore, imports are usually wrap into a try/except. An import present in `websocket_rate_limiting` is not wrapped leading to errors for those who have not the library installed. This PR fixes this issue by wrapping this import in a try/except block. closes odoo/odoo#98763 Signed-off-by: Sébastien Theys (seb) --- addons/bus/tests/test_websocket_rate_limiting.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/bus/tests/test_websocket_rate_limiting.py b/addons/bus/tests/test_websocket_rate_limiting.py index 4c864fe669d..b1063d48b83 100644 --- a/addons/bus/tests/test_websocket_rate_limiting.py +++ b/addons/bus/tests/test_websocket_rate_limiting.py @@ -2,7 +2,11 @@ import json import time -from websocket._exceptions import WebSocketProtocolException + +try: + from websocket._exceptions import WebSocketProtocolException +except ImportError: + pass from odoo.tests import common from .common import WebsocketCase