[IMP] tests: add registry cleanups in Single and Savepoint tests

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 <rco@odoo.com>
This commit is contained in:
Damien Bouvy
2020-01-31 12:06:46 +00:00
co-authored by Raphaël Collet
parent c643be7679
commit 8dab6caf46
+1
View File
@@ -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()