From 8dab6caf468bde2cab03b89c6c48dd8a9ff1cf52 Mon Sep 17 00:00:00 2001 From: Damien Bouvy Date: Thu, 30 Jan 2020 15:32:54 +0000 Subject: [PATCH] [IMP] tests: add registry cleanups in Single and Savepoint tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In some cases, the registry might be updated during a test step (creating custom models/fields, for example). In those cases, there should be an explicit call to `reset_changes` on the registry to make sure that the next test class starts with a registry that is consistent with the database state. Co-Authored-By: Raphaƫl Collet --- odoo/tests/common.py | 1 + 1 file changed, 1 insertion(+) diff --git a/odoo/tests/common.py b/odoo/tests/common.py index 447171cfd55..6dbc576b7be 100644 --- a/odoo/tests/common.py +++ b/odoo/tests/common.py @@ -560,6 +560,7 @@ class SingleTransactionCase(BaseCase): def setUpClass(cls): super().setUpClass() cls.registry = odoo.registry(get_db_name()) + cls.addClassCleanup(cls.registry.reset_changes) cls.addClassCleanup(cls.registry.clear_caches) cls.cr = cls.registry.cursor()