From e4dc9a32db66edf41313681ea066ce5d375c5b94 Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Thu, 18 Jan 2024 13:39:30 +0100 Subject: [PATCH] [FIX] mrp_account, stock_account: deduplicate tests When a test case class inherits from another class that has test methods, those tests are executed again for both classes. While it could be done on purpose, it does not seems to be the case here. Moreover, in this particular case, we are talking about 51 tests. Also, as the child class is tagged `post_install` those tests are run again on runbot in a post install build. closes odoo/odoo#150028 X-original-commit: ee747ae5c68871d58647a263d54bb658ef43eece Signed-off-by: Arnold Moyaux (arm) Signed-off-by: Christophe Monniez (moc) --- addons/mrp_account/tests/test_valuation_layers.py | 4 ++-- addons/stock_account/tests/test_stockvaluation.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/mrp_account/tests/test_valuation_layers.py b/addons/mrp_account/tests/test_valuation_layers.py index f7e218199cf..88b7cbe596b 100644 --- a/addons/mrp_account/tests/test_valuation_layers.py +++ b/addons/mrp_account/tests/test_valuation_layers.py @@ -4,7 +4,7 @@ """ Implementation of "INVENTORY VALUATION TESTS (With valuation layers)" spreadsheet. """ from odoo.addons.stock_account.tests.test_stockvaluationlayer import TestStockValuationCommon -from odoo.addons.stock_account.tests.test_stockvaluation import TestStockValuation +from odoo.addons.stock_account.tests.test_stockvaluation import TestStockValuationBase from odoo.tests import Form from odoo.tests.common import tagged @@ -390,7 +390,7 @@ class TestMrpValuationStandard(TestMrpValuationCommon): @tagged("post_install", "-at_install") -class TestMrpStockValuation(TestStockValuation): +class TestMrpStockValuation(TestStockValuationBase): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/addons/stock_account/tests/test_stockvaluation.py b/addons/stock_account/tests/test_stockvaluation.py index 14ae486d7b9..cdeb2156375 100644 --- a/addons/stock_account/tests/test_stockvaluation.py +++ b/addons/stock_account/tests/test_stockvaluation.py @@ -46,10 +46,10 @@ def _create_accounting_data(env): return stock_input_account, stock_output_account, stock_valuation_account, expense_account, stock_journal -class TestStockValuation(TransactionCase): +class TestStockValuationBase(TransactionCase): @classmethod def setUpClass(cls): - super(TestStockValuation, cls).setUpClass() + super().setUpClass() cls.env.ref('base.EUR').active = True cls.stock_location = cls.env.ref('stock.stock_location_stock') cls.customer_location = cls.env.ref('stock.stock_location_customers') @@ -146,6 +146,7 @@ class TestStockValuation(TransactionCase): out_move._action_done() return out_move.with_context(svl=True) +class TestStockValuation(TestStockValuationBase): def test_realtime(self): """ Stock moves update stock value with product x cost price, price change updates the stock value based on current stock level.