summaryrefslogtreecommitdiff
path: root/openerp/sql_db.py
diff options
context:
space:
mode:
authorRaphael Collet <rco@openerp.com>2014-04-09 12:33:37 +0200
committerRaphael Collet <rco@openerp.com>2014-04-09 12:33:37 +0200
commitfd8fd0906f3ecb79c9316d4dffbc6ae0b6377de7 (patch)
tree0df30edbff45124210d78767bbd978a5b028641b /openerp/sql_db.py
parente5e00e4c0af8a8c9eb1eb57c0985509ddc36032c (diff)
[IMP] make TestCursor more robust, and remove some tests on tools.config['test_enable']
bzr revid: rco@openerp.com-20140409103337-r0a1nx9h8nfg3cn3
Diffstat (limited to 'openerp/sql_db.py')
-rw-r--r--openerp/sql_db.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/openerp/sql_db.py b/openerp/sql_db.py
index c93f4fbb92f..126460f5317 100644
--- a/openerp/sql_db.py
+++ b/openerp/sql_db.py
@@ -391,7 +391,6 @@ class TestCursor(Cursor):
super(TestCursor, self).__init__(*args, **kwargs)
super(TestCursor, self).execute("SAVEPOINT test_cursor")
self._lock = threading.RLock()
- self._auto_commit = False
def acquire(self):
self._lock.acquire()
@@ -401,18 +400,16 @@ class TestCursor(Cursor):
def execute(self, *args, **kwargs):
super(TestCursor, self).execute(*args, **kwargs)
- if self._auto_commit:
- self.commit()
def close(self, force=False):
- self.rollback() # for stuff that has not been committed
if force:
super(TestCursor, self).close()
- else:
+ elif not self._closed:
+ self.rollback() # for stuff that has not been committed
self.release()
def autocommit(self, on):
- self._auto_commit = on
+ _logger.debug("TestCursor.autocommit(%r) does nothing", on)
def commit(self):
super(TestCursor, self).execute("RELEASE SAVEPOINT test_cursor")