16.0 vanila

This commit is contained in:
Ernad Husremovic 2025-10-03 17:53:49 +02:00
parent 956889352c
commit 2e65bf056a
17 changed files with 5293 additions and 17668 deletions

View file

@ -470,9 +470,6 @@ class BaseCase(case.TestCase, metaclass=MetaCase):
The second form is convenient when used with :func:`users`.
"""
if not 'is_query_count' in self.test_tags:
# change into warning in master
self._logger.info('assertQueryCount is used but the test is not tagged `is_query_count`')
if self.warm:
# mock random in order to avoid random bus gc
with patch('random.random', lambda: 1):
@ -729,9 +726,10 @@ class BaseCase(case.TestCase, metaclass=MetaCase):
"""Guess if the test_methods is a query_count and adds an `is_query_count` tag on the test
"""
additional_tags = []
method_source = inspect.getsource(test_method) if test_method else ''
if 'self.assertQueryCount' in method_source:
additional_tags.append('is_query_count')
if odoo.tools.config['test_tags'] and 'is_query_count' in odoo.tools.config['test_tags']:
method_source = inspect.getsource(test_method) if test_method else ''
if 'self.assertQueryCount' in method_source:
additional_tags.append('is_query_count')
return additional_tags
savepoint_seq = itertools.count()
@ -1220,6 +1218,13 @@ class ChromeBrowser:
self._logger.debug('\n<- %s', msg)
except websocket.WebSocketTimeoutException:
continue
except websocket.WebSocketConnectionClosedException as e:
if not self._result.done():
del self.ws
self._result.set_exception(e)
for f in self._responses.values():
f.cancel()
return
except Exception as e:
if isinstance(e, ConnectionResetError) and self._result.done():
return
@ -1254,8 +1259,8 @@ class ChromeBrowser:
def _websocket_request(self, method, *, params=None, timeout=10.0):
assert threading.get_ident() != self._receiver.ident,\
"_websocket_request must not be called from the consumer thread"
if self.ws is None:
return
if not hasattr(self, 'ws'):
return None
f = self._websocket_send(method, params=params, with_future=True)
try:
@ -1268,8 +1273,8 @@ class ChromeBrowser:
If ``with_future`` is set, returns a ``Future`` for the operation.
"""
if self.ws is None:
return
if not hasattr(self, 'ws'):
return None
result = None
request_id = next(self._request_id)
@ -1466,7 +1471,8 @@ which leads to stray network requests and inconsistencies."""
self._logger.info('Asking for screenshot')
f = self._websocket_send('Page.captureScreenshot', with_future=True)
f.add_done_callback(handler)
if f:
f.add_done_callback(handler)
return f
def _save_screencast(self, prefix='failed'):
@ -2039,9 +2045,6 @@ class HttpCase(TransactionCase):
"""Wrapper for `browser_js` to start the given `tour_name` with the
optional delay between steps `step_delay`. Other arguments from
`browser_js` can be passed as keyword arguments."""
if not 'is_tour' in self.test_tags:
# change it into warning in master
self._logger.info('start_tour was called from a test not tagged `is_tour`')
step_delay = ', %s' % step_delay if step_delay else ''
code = kwargs.pop('code', "odoo.startTour('%s'%s)" % (tour_name, step_delay))
ready = kwargs.pop('ready', "odoo.__DEBUG__.services['web_tour.tour'].tours['%s'].ready" % tour_name)
@ -2062,9 +2065,10 @@ class HttpCase(TransactionCase):
guess if the test_methods is a tour and adds an `is_tour` tag on the test
"""
additional_tags = super().get_method_additional_tags(test_method)
method_source = inspect.getsource(test_method)
if 'self.start_tour' in method_source:
additional_tags.append('is_tour')
if odoo.tools.config['test_tags'] and 'is_tour' in odoo.tools.config['test_tags']:
method_source = inspect.getsource(test_method)
if 'self.start_tour' in method_source:
additional_tags.append('is_tour')
return additional_tags
# kept for backward compatibility

View file

@ -176,6 +176,7 @@ def test_uninstall(args):
def test_standalone(args):
""" Tries to launch standalone scripts tagged with @post_testing """
odoo.service.db._check_faketime_mode(args.database) # noqa: SLF001
# load the registry once for script discovery
registry = odoo.registry(args.database)
for module_name in registry._init_modules: