From 96d9f262023033ea3a4618ea81dbf12e8c185605 Mon Sep 17 00:00:00 2001 From: SilvioC2C Date: Fri, 12 Jun 2026 16:57:20 +0200 Subject: [PATCH 1/2] [IMP] component: improve test setup Class ``TransactionComponentCase.setUp()`` was not calling ``super()`` because of an inheritance issue: ``odoo.tests.common.TransactionCase.setUp()`` was not calling ``super()`` either. Since the issue has been solved, the test setup can be improved, allowing subclasses that inherit from ``TransactionComponentCase`` to correctly resolve the chain of ``super().setUp()`` calls. --- component/tests/common.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/component/tests/common.py b/component/tests/common.py index 49133c4ee..05e8c5901 100644 --- a/component/tests/common.py +++ b/component/tests/common.py @@ -74,20 +74,6 @@ def setUpClass(cls): super().setUpClass() cls.setUpComponent() - # pylint: disable=W8106 - def setUp(self): - # resolve an inheritance issue (common.TransactionCase does not call - # super) - common.TransactionCase.setUp(self) - ComponentMixin.setUp(self) - # There's no env on setUpClass of TransactionCase, must do it here. - self.env = self.env( - context=dict( - self.env.context, - components_registry=self._components_registry, - ) - ) - class ComponentRegistryCase: """This test case can be used as a base for writings tests on components From 048c4713b020ef4ea60e6eba9b9e93a0ed5df1d5 Mon Sep 17 00:00:00 2001 From: SilvioC2C Date: Wed, 17 Jun 2026 13:05:57 +0200 Subject: [PATCH 2/2] [FIX] component: fix test setup Commit 96d9f26 improved test setup, but introduced a bug: the components registry was never flagged as 'ready' anymore. This commit fixes such bug. --- component/tests/common.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/component/tests/common.py b/component/tests/common.py index 05e8c5901..ae2f5e498 100644 --- a/component/tests/common.py +++ b/component/tests/common.py @@ -46,10 +46,6 @@ def setUpComponent(cls): ) ) - # pylint: disable=W8106 - def setUp(self): - self.setUpComponentRegistryReady() - def setUpComponentRegistryReady(self): # should be ready only during tests, never during installation # of addons @@ -74,6 +70,10 @@ def setUpClass(cls): super().setUpClass() cls.setUpComponent() + def setUp(self): + super().setUp() + self.setUpComponentRegistryReady() + class ComponentRegistryCase: """This test case can be used as a base for writings tests on components