diff options
author | Gerhard Häring <gh@ghaering.de> | 2008-02-29 22:08:41 +0000 |
---|---|---|
committer | Gerhard Häring <gh@ghaering.de> | 2008-02-29 22:08:41 +0000 |
commit | 1cc60ed214d83b1901a9e68782559c18f705ff07 (patch) | |
tree | 31d9638597c104accd2d2149095b16b9e8c22325 /Lib/sqlite3/test/transactions.py | |
parent | 0e795e7d9225837bc6949a951ba514feab18f9ef (diff) | |
download | cpython-git-1cc60ed214d83b1901a9e68782559c18f705ff07.tar.gz |
Updated to pysqlite 2.4.1. Documentation additions will come later.
Diffstat (limited to 'Lib/sqlite3/test/transactions.py')
-rw-r--r-- | Lib/sqlite3/test/transactions.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/Lib/sqlite3/test/transactions.py b/Lib/sqlite3/test/transactions.py index 1f0b19aa9b..14cae25001 100644 --- a/Lib/sqlite3/test/transactions.py +++ b/Lib/sqlite3/test/transactions.py @@ -1,7 +1,7 @@ #-*- coding: ISO-8859-1 -*- # pysqlite2/test/transactions.py: tests transactions # -# Copyright (C) 2005 Gerhard Häring <gh@ghaering.de> +# Copyright (C) 2005-2007 Gerhard Häring <gh@ghaering.de> # # This file is part of pysqlite. # @@ -21,6 +21,7 @@ # misrepresented as being the original software. # 3. This notice may not be removed or altered from any source distribution. +import sys import os, unittest import sqlite3 as sqlite @@ -119,6 +120,23 @@ class TransactionTests(unittest.TestCase): except: self.fail("should have raised an OperationalError") + def CheckLocking(self): + """ + This tests the improved concurrency with pysqlite 2.3.4. You needed + to roll back con2 before you could commit con1. + """ + self.cur1.execute("create table test(i)") + self.cur1.execute("insert into test(i) values (5)") + try: + self.cur2.execute("insert into test(i) values (5)") + self.fail("should have raised an OperationalError") + except sqlite.OperationalError: + pass + except: + self.fail("should have raised an OperationalError") + # NO self.con2.rollback() HERE!!! + self.con1.commit() + class SpecialCommandTests(unittest.TestCase): def setUp(self): self.con = sqlite.connect(":memory:") |