From 7d9d5400fc4115571249d1eae5101a343f6ab6c4 Mon Sep 17 00:00:00 2001 From: josep-tecnativa Date: Mon, 16 Oct 2023 12:27:21 +0200 Subject: [PATCH] [IMP] account_payment_order: test performance improvement - Create setUpClass method - Switch to setUpClass (if needed) for avoiding repeat the same setup for each test. - Include context keys for avoiding mail operations overhead. --- account_payment_order/tests/test_bank.py | 7 +++++++ account_payment_order/tests/test_payment_mode.py | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/account_payment_order/tests/test_bank.py b/account_payment_order/tests/test_bank.py index d5d78bf81..218f96b78 100644 --- a/account_payment_order/tests/test_bank.py +++ b/account_payment_order/tests/test_bank.py @@ -4,8 +4,15 @@ from odoo.exceptions import ValidationError from odoo.tests.common import TransactionCase +from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT + class TestBank(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT)) + def test_bank(self): bank = self.env["res.bank"].search([], limit=1) self.assertTrue(bank) diff --git a/account_payment_order/tests/test_payment_mode.py b/account_payment_order/tests/test_payment_mode.py index a5c30f520..f1f346cb3 100644 --- a/account_payment_order/tests/test_payment_mode.py +++ b/account_payment_order/tests/test_payment_mode.py @@ -18,7 +18,6 @@ class TestPaymentMode(TransactionCase): AccountPaymentMethod._get_payment_method_information ) - @classmethod def _get_payment_method_information(cls): res = Method_get_payment_method_information(cls) res["IN"] = {"mode": "multi", "domain": [("type", "=", "bank")]}