[FIX] tests: don't pregenerate asset bundles for upgrade tests
Pregenerate doesn't work for rtl languages. It shouldn't be a problem
but it was discovered that pregenerate run during upgrades leading to
errors
```
Traceback (most recent call last):
File "/home/odoo/src/odoo/16.0/odoo/service/server.py", line 1314, in preload_registries
env['ir.qweb']._pregenerate_assets_bundles()
File "/home/odoo/src/odoo/16.0/addons/website/models/ir_qweb.py", line 180, in _pregenerate_assets_bundles
_, _, _, id_unique, name = bundle_url.split('/')
ValueError: too many values to unpack (expected 5)tore the set of known environments as it was at setUp
```
This is because the rtl is an extra in the url breaking the logic.
Pregenerate is mainly usefull for tests on runbot
(or running tests locally), to speedup httpcases
avoiding generation at each page load.
IntegrityCases are postinstall but don't requires generating assets, or
at least no so often meaning that we can avoid the pregeneration in this
case. It should also avoid losing some time on pregeneration since it
is not useful.
This new logic only pregenerate if we have at least one HTTPCase in the
test suite. This should also speedup local testing when starting
non http post_install tests.
closes odoo/odoo#107107
X-original-commit: 43a5c17088707eec134d54ccf9341e86859f88c7
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
This commit is contained in:
@@ -1308,7 +1308,7 @@ def preload_registries(dbnames):
|
||||
_logger.info("Starting post tests")
|
||||
tests_before = registry._assertion_report.testsRun
|
||||
post_install_suite = loader.make_suite(module_names, 'post_install')
|
||||
if post_install_suite.countTestCases():
|
||||
if post_install_suite.has_http_case():
|
||||
with registry.cursor() as cr:
|
||||
env = odoo.api.Environment(cr, odoo.SUPERUSER_ID, {})
|
||||
env['ir.qweb']._pregenerate_assets_bundles()
|
||||
|
||||
@@ -320,6 +320,9 @@ class OdooSuite(BackportSuite):
|
||||
with result.collectStats(test_id):
|
||||
super()._tearDownPreviousClass(test, result)
|
||||
|
||||
def has_http_case(self):
|
||||
return self.countTestCases() and any(isinstance(test_case, HttpCase) for test_case in self)
|
||||
|
||||
|
||||
class MetaCase(type):
|
||||
""" Metaclass of test case classes to assign default 'test_tags':
|
||||
|
||||
Reference in New Issue
Block a user