diff options
| author | Damien Bouvy <dbo@odoo.com> | 2020-01-30 15:32:54 +0000 |
|---|---|---|
| committer | Damien Bouvy <dbo@odoo.com> | 2020-01-31 12:06:46 +0000 |
| commit | 8dab6caf468bde2cab03b89c6c48dd8a9ff1cf52 (patch) | |
| tree | 03819378feb9041f640b358a1ecd671113d880e7 /odoo/tests | |
| parent | c643be7679921026a87ff307d57b38c174ec439e (diff) | |
[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>
Diffstat (limited to 'odoo/tests')
| -rw-r--r-- | odoo/tests/common.py | 1 |
1 files changed, 1 insertions, 0 deletions
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() |
