]> granicus.if.org Git - python/commitdiff
Prevent test_sqlite from hanging on older versions of sqlite.
authorNeal Norwitz <nnorwitz@gmail.com>
Sat, 5 Apr 2008 04:26:31 +0000 (04:26 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sat, 5 Apr 2008 04:26:31 +0000 (04:26 +0000)
The problem is that when trying to do the second insert, sqlite seems to sleep
for a very long time.  Here is the output from strace:

  read(6, "SQLite format 3\0\4\0\1\1\0@  \0\0\0\1\0\0\0\0"..., 1024) = 1024
  nanosleep({4294, 966296000},  <unfinished ...>

I don't know which version this was fixed in, but 3.2.1 definitely fails.

Lib/sqlite3/test/transactions.py

index d4f7d622ed84821c39c6af0dea4fce88bc36ab34..9cc6e104c0d0c632244d71ee7660e9874645ad09 100644 (file)
@@ -113,6 +113,10 @@ class TransactionTests(unittest.TestCase):
         self.failUnlessEqual(len(res), 1)
 
     def CheckRaiseTimeout(self):
+        if sqlite.sqlite_version_info < (3, 2, 2):
+            # This will fail (hang) on earlier versions of sqlite.
+            # Determine exact version it was fixed. 3.2.1 hangs.
+            return
         self.cur1.execute("create table test(i)")
         self.cur1.execute("insert into test(i) values (5)")
         try:
@@ -128,6 +132,10 @@ class TransactionTests(unittest.TestCase):
         This tests the improved concurrency with pysqlite 2.3.4. You needed
         to roll back con2 before you could commit con1.
         """
+        if sqlite.sqlite_version_info < (3, 2, 2):
+            # This will fail (hang) on earlier versions of sqlite.
+            # Determine exact version it was fixed. 3.2.1 hangs.
+            return
         self.cur1.execute("create table test(i)")
         self.cur1.execute("insert into test(i) values (5)")
         try: