summaryrefslogtreecommitdiffstats
path: root/Lib/sqlite3/test/transactions.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/sqlite3/test/transactions.py')
-rw-r--r--Lib/sqlite3/test/transactions.py40
1 files changed, 22 insertions, 18 deletions
diff --git a/Lib/sqlite3/test/transactions.py b/Lib/sqlite3/test/transactions.py
index c463f74..3b47ff1 100644
--- a/Lib/sqlite3/test/transactions.py
+++ b/Lib/sqlite3/test/transactions.py
@@ -52,7 +52,7 @@ class TransactionTests(unittest.TestCase):
except OSError:
pass
- def CheckDMLDoesNotAutoCommitBefore(self):
+ def test_dml_does_not_auto_commit_before(self):
self.cur1.execute("create table test(i)")
self.cur1.execute("insert into test(i) values (5)")
self.cur1.execute("create table test2(j)")
@@ -60,14 +60,14 @@ class TransactionTests(unittest.TestCase):
res = self.cur2.fetchall()
self.assertEqual(len(res), 0)
- def CheckInsertStartsTransaction(self):
+ def test_insert_starts_transaction(self):
self.cur1.execute("create table test(i)")
self.cur1.execute("insert into test(i) values (5)")
self.cur2.execute("select i from test")
res = self.cur2.fetchall()
self.assertEqual(len(res), 0)
- def CheckUpdateStartsTransaction(self):
+ def test_update_starts_transaction(self):
self.cur1.execute("create table test(i)")
self.cur1.execute("insert into test(i) values (5)")
self.con1.commit()
@@ -76,7 +76,7 @@ class TransactionTests(unittest.TestCase):
res = self.cur2.fetchone()[0]
self.assertEqual(res, 5)
- def CheckDeleteStartsTransaction(self):
+ def test_delete_starts_transaction(self):
self.cur1.execute("create table test(i)")
self.cur1.execute("insert into test(i) values (5)")
self.con1.commit()
@@ -85,7 +85,7 @@ class TransactionTests(unittest.TestCase):
res = self.cur2.fetchall()
self.assertEqual(len(res), 1)
- def CheckReplaceStartsTransaction(self):
+ def test_replace_starts_transaction(self):
self.cur1.execute("create table test(i)")
self.cur1.execute("insert into test(i) values (5)")
self.con1.commit()
@@ -95,7 +95,7 @@ class TransactionTests(unittest.TestCase):
self.assertEqual(len(res), 1)
self.assertEqual(res[0][0], 5)
- def CheckToggleAutoCommit(self):
+ def test_toggle_auto_commit(self):
self.cur1.execute("create table test(i)")
self.cur1.execute("insert into test(i) values (5)")
self.con1.isolation_level = None
@@ -111,13 +111,13 @@ class TransactionTests(unittest.TestCase):
res = self.cur2.fetchall()
self.assertEqual(len(res), 1)
- def CheckRaiseTimeout(self):
+ def test_raise_timeout(self):
self.cur1.execute("create table test(i)")
self.cur1.execute("insert into test(i) values (5)")
with self.assertRaises(sqlite.OperationalError):
self.cur2.execute("insert into test(i) values (5)")
- def CheckLocking(self):
+ def test_locking(self):
"""
This tests the improved concurrency with pysqlite 2.3.4. You needed
to roll back con2 before you could commit con1.
@@ -129,7 +129,7 @@ class TransactionTests(unittest.TestCase):
# NO self.con2.rollback() HERE!!!
self.con1.commit()
- def CheckRollbackCursorConsistency(self):
+ def test_rollback_cursor_consistency(self):
"""
Checks if cursors on the connection are set into a "reset" state
when a rollback is done on the connection.
@@ -149,12 +149,12 @@ class SpecialCommandTests(unittest.TestCase):
self.con = sqlite.connect(":memory:")
self.cur = self.con.cursor()
- def CheckDropTable(self):
+ def test_drop_table(self):
self.cur.execute("create table test(i)")
self.cur.execute("insert into test(i) values (5)")
self.cur.execute("drop table test")
- def CheckPragma(self):
+ def test_pragma(self):
self.cur.execute("create table test(i)")
self.cur.execute("insert into test(i) values (5)")
self.cur.execute("pragma count_changes=1")
@@ -167,7 +167,7 @@ class TransactionalDDL(unittest.TestCase):
def setUp(self):
self.con = sqlite.connect(":memory:")
- def CheckDdlDoesNotAutostartTransaction(self):
+ def test_ddl_does_not_autostart_transaction(self):
# For backwards compatibility reasons, DDL statements should not
# implicitly start a transaction.
self.con.execute("create table test(i)")
@@ -175,7 +175,7 @@ class TransactionalDDL(unittest.TestCase):
result = self.con.execute("select * from test").fetchall()
self.assertEqual(result, [])
- def CheckImmediateTransactionalDDL(self):
+ def test_immediate_transactional_ddl(self):
# You can achieve transactional DDL by issuing a BEGIN
# statement manually.
self.con.execute("begin immediate")
@@ -184,7 +184,7 @@ class TransactionalDDL(unittest.TestCase):
with self.assertRaises(sqlite.OperationalError):
self.con.execute("select * from test")
- def CheckTransactionalDDL(self):
+ def test_transactional_ddl(self):
# You can achieve transactional DDL by issuing a BEGIN
# statement manually.
self.con.execute("begin")
@@ -197,10 +197,14 @@ class TransactionalDDL(unittest.TestCase):
self.con.close()
def suite():
- default_suite = unittest.makeSuite(TransactionTests, "Check")
- special_command_suite = unittest.makeSuite(SpecialCommandTests, "Check")
- ddl_suite = unittest.makeSuite(TransactionalDDL, "Check")
- return unittest.TestSuite((default_suite, special_command_suite, ddl_suite))
+ tests = [
+ SpecialCommandTests,
+ TransactionTests,
+ TransactionalDDL,
+ ]
+ return unittest.TestSuite(
+ [unittest.TestLoader().loadTestsFromTestCase(t) for t in tests]
+ )
def test():
runner = unittest.TextTestRunner()