don't issue critical message when trying to alter sqlite db during test stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 24 Feb 2010 11:05:01 +0100
branchstable
changeset 4682 4994901b7379
parent 4681 5f72584ab1d7
child 4683 c375d50eaad3
don't issue critical message when trying to alter sqlite db during test
server/sources/native.py
--- a/server/sources/native.py	Wed Feb 24 11:04:28 2010 +0100
+++ b/server/sources/native.py	Wed Feb 24 11:05:01 2010 +0100
@@ -421,8 +421,11 @@
             # str(query) to avoid error if it's an unicode string
             cursor.execute(str(query), args)
         except Exception, ex:
-            self.critical("sql: %r\n args: %s\ndbms message: %r",
-                          query, args, ex.args[0])
+            if self.repo.config.mode != 'test':
+                # during test we get those message when trying to alter sqlite
+                # db schema
+                self.critical("sql: %r\n args: %s\ndbms message: %r",
+                              query, args, ex.args[0])
             if rollback:
                 try:
                     session.pool.connection(self.uri).rollback()
@@ -443,8 +446,11 @@
             # str(query) to avoid error if it's an unicode string
             cursor.executemany(str(query), args)
         except Exception, ex:
-            self.critical("sql many: %r\n args: %s\ndbms message: %r",
-                          query, args, ex.args[0])
+            if self.repo.config.mode != 'test':
+                # during test we get those message when trying to alter sqlite
+                # db schema
+                self.critical("sql many: %r\n args: %s\ndbms message: %r",
+                              query, args, ex.args[0])
             try:
                 session.pool.connection(self.uri).rollback()
                 self.critical('transaction has been rollbacked')