diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-02-05 18:38:19 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-02-05 18:38:19 +0100 |
| commit | 0c42a607ece06b6295ba9d2c71bd8862e4e253ae (patch) | |
| tree | dfd773bafbf2c3eee31e6506147aed2ca70802be /odoo/addons/base/tests/test_db_cursor.py | |
| parent | 9c6acbaaa0a9515c134ccabb26232b0acf18f408 (diff) | |
[FIX] base: correct TestCursor test to explicitly close the cursor
Diffstat (limited to 'odoo/addons/base/tests/test_db_cursor.py')
| -rw-r--r-- | odoo/addons/base/tests/test_db_cursor.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/odoo/addons/base/tests/test_db_cursor.py b/odoo/addons/base/tests/test_db_cursor.py index 1e945bf975c..839bcff6f89 100644 --- a/odoo/addons/base/tests/test_db_cursor.py +++ b/odoo/addons/base/tests/test_db_cursor.py @@ -33,13 +33,22 @@ class TestExecute(unittest.TestCase): class TestTestCursor(common.TransactionCase): + @classmethod + def setUpClass(cls): + super(TestTestCursor, cls).setUpClass() + r = registry() + r.enter_test_mode(r.cursor()) + + @classmethod + def tearDownClass(cls): + r = registry() + r.test_cr.close() + r.leave_test_mode() + super(TestTestCursor, cls).tearDownClass() def setUp(self): super(TestTestCursor, self).setUp() - self.registry.enter_test_mode(self.cr) - self.addCleanup(self.registry.leave_test_mode) self.record = self.env['res.partner'].create({'name': 'Foo'}) - self.cr = self.cursor() def write(self, record, value): record.ref = value |
