diff options
author | Gerhard Häring <gh@ghaering.de> | 2008-03-29 00:45:29 (GMT) |
---|---|---|
committer | Gerhard Häring <gh@ghaering.de> | 2008-03-29 00:45:29 (GMT) |
commit | e7ea7451a84636655927da4b9731d2eb37d1cf34 (patch) | |
tree | 7862ebdca8d04d799ddeacf4cf74e2a130e376b4 /Lib/sqlite3/test/transactions.py | |
parent | b1b9382d91e4b2e863225179cde4a61f0300a233 (diff) | |
download | cpython-e7ea7451a84636655927da4b9731d2eb37d1cf34.zip cpython-e7ea7451a84636655927da4b9731d2eb37d1cf34.tar.gz cpython-e7ea7451a84636655927da4b9731d2eb37d1cf34.tar.bz2 |
Bring sqlite3 module up-to-date with what's now in 2.6. Almost. I intentionally
left out the stuff about creating a connection object from a APSW connection.
Diffstat (limited to 'Lib/sqlite3/test/transactions.py')
-rw-r--r-- | Lib/sqlite3/test/transactions.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Lib/sqlite3/test/transactions.py b/Lib/sqlite3/test/transactions.py index 9edc4ac..da5bd21 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. # @@ -122,6 +122,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:") |