[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) <arm@odoo.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
This commit is contained in:
Christophe Monniez
2024-01-20 02:42:59 +00:00
parent 74d7ad5185
commit e4dc9a32db
2 changed files with 5 additions and 4 deletions
@@ -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()
@@ -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.