From 1c598d4b00d07cac098d15fa401c555d733d91ba Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Mon, 24 Jul 2023 16:24:47 +0000 Subject: [PATCH] [FIX] base: avoid being stuck on a test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During the nightly, it looks like some test in `TestAccountEarlyPaymentDiscount` will reload the registry, restarting all base tests, including `.test_add_field_valid` This test cannot be executed on an existing database without providing a `-i` for a strange reason. If this is not a real issue, this simple assertion will avoid to get stuck while running this test on an existing database. closes odoo/odoo#129491 X-original-commit: 4c6e05cbb43d08c544d9d558f80b67ccb786d482 Signed-off-by: Xavier Dollé (xdo) --- odoo/addons/base/tests/test_ir_actions.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/odoo/addons/base/tests/test_ir_actions.py b/odoo/addons/base/tests/test_ir_actions.py index f940ce63cfe..4c4d3942a51 100644 --- a/odoo/addons/base/tests/test_ir_actions.py +++ b/odoo/addons/base/tests/test_ir_actions.py @@ -6,7 +6,7 @@ from psycopg2 import IntegrityError, ProgrammingError import odoo from odoo.exceptions import UserError, ValidationError, AccessError -from odoo.tools import mute_logger +from odoo.tools import mute_logger, config from odoo.tests import common from odoo import Command @@ -407,6 +407,10 @@ class TestCustomFields(common.TransactionCase): This is to forbid users to override class attributes. """ + # For a strange reason, drop constraint will remain stuck if executed without initiating base. (even on an existing database) + # small assertion to avoid getting stuck on this test in this case. + self.assertIn('base', config['init'], 'This test can only be executed while installing base') + field = self.create_field('x_foo') # Drop the SQL constraint, to bypass it, # as a user could do through a SQL shell or a `cr.execute` in a server action