summaryrefslogtreecommitdiff
path: root/odoo/tests
diff options
context:
space:
mode:
authorChristophe Monniez <moc@odoo.com>2020-02-14 15:23:11 +0000
committerChristophe Monniez <moc@odoo.com>2020-02-20 16:53:33 +0000
commit426fc163bac0aa76fa231d1253e966dea8aca39d (patch)
treed6b412acccf483d771b39c2fe7e114925492b18d /odoo/tests
parent54e1a69b09aaaaa6299a7b8d1dfd4bfc7ab3e792 (diff)
[FIX] tests: avoid confusing traceback at browser start
During an HttpCase, when the Chrome browser starts, it may happens that the websocket is unreachable. In such a case, the stop method is called and tries to stop the browser gracefully by sending a `Browser.close` through the websocket ... which is not reachable. The result is a confusing traceback. With this commit, nothing is sent is the websocket is not available. Moreover, the `sigxcpu_handler` attribute is used in the stop method but not yet declared. Fixed by moving it before calling the _chrome_start method. X-original-commit: 0d156fd3bc114b40680ca5aa0456e0f21a5b8cff
Diffstat (limited to 'odoo/tests')
-rw-r--r--odoo/tests/common.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/odoo/tests/common.py b/odoo/tests/common.py
index c72832b4ad0..c68aaf0e515 100644
--- a/odoo/tests/common.py
+++ b/odoo/tests/common.py
@@ -644,6 +644,7 @@ class ChromeBrowser():
os.makedirs(self.screenshots_dir, exist_ok=True)
self.window_size = window_size
+ self.sigxcpu_handler = None
self._chrome_start()
self._find_websocket()
self._logger.info('Websocket url found: %s', self.ws_url)
@@ -652,7 +653,6 @@ class ChromeBrowser():
self._websocket_send('Runtime.enable')
self._logger.info('Chrome headless enable page notifications')
self._websocket_send('Page.enable')
- self.sigxcpu_handler = None
if os.name == 'posix':
self.sigxcpu_handler = signal.getsignal(signal.SIGXCPU)
signal.signal(signal.SIGXCPU, self.signal_handler)
@@ -811,6 +811,8 @@ class ChromeBrowser():
"""
send chrome devtools protocol commands through websocket
"""
+ if self.ws is None:
+ return
sent_id = self.request_id
payload = {
'method': method,