FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Mark tests as skipped when a SQLite version is not supported · python-emscripten/cpython@f85bce7 · GitHub

Repository navigation

Commit f85bce7

Browse files
committed
Mark tests as skipped when a SQLite version is not supported
1 parent 2b50899 commit f85bce7

4 files changed

Lines changed: 9 additions & 16 deletions

File tree

‎Lib/sqlite3/test/dbapi.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,9 @@ def CheckOpenUri(self):
177177
with self.assertRaises(sqlite.OperationalError):
178178
cx.execute('insert into test(id) values(1)')
179179

180+
@unittest.skipIf(sqlite.sqlite_version_info >= (3, 3, 1),
181+
'needs sqlite versions older than 3.3.1')
180182
def CheckSameThreadErrorOnOldVersion(self):
181-
if sqlite.sqlite_version_info >= (3, 3, 1):
182-
self.skipTest('test needs sqlite3 versions older than 3.3.1')
183183
with self.assertRaises(sqlite.NotSupportedError) as cm:
184184
sqlite.connect(':memory:', check_same_thread=False)
185185
self.assertEqual(str(cm.exception), 'shared connections not available')

‎Lib/sqlite3/test/regression.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,8 @@ def CheckStatementFinalizationOnCloseDb(self):
8484
cur.execute("select 1 x union select " + str(i))
8585
con.close()
8686

87+
@unittest.skipIf(sqlite.sqlite_version_info < (3, 2, 2), 'needs sqlite 3.2.2 or newer')
8788
def CheckOnConflictRollback(self):
88-
if sqlite.sqlite_version_info < (3, 2, 2):
89-
return
9089
con = sqlite.connect(":memory:")
9190
con.execute("create table foo(x, unique(x) on conflict rollback)")
9291
con.execute("insert into foo(x) values (1)")

‎Lib/sqlite3/test/transactions.py‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,25 +111,21 @@ def CheckToggleAutoCommit(self):
111111
res = self.cur2.fetchall()
112112
self.assertEqual(len(res), 1)
113113

114+
@unittest.skipIf(sqlite.sqlite_version_info < (3, 2, 2),
115+
'test hangs on sqlite versions older than 3.2.2')
114116
def CheckRaiseTimeout(self):
115-
if sqlite.sqlite_version_info < (3, 2, 2):
116-
# This will fail (hang) on earlier versions of sqlite.
117-
# Determine exact version it was fixed. 3.2.1 hangs.
118-
return
119117
self.cur1.execute("create table test(i)")
120118
self.cur1.execute("insert into test(i) values (5)")
121119
with self.assertRaises(sqlite.OperationalError):
122120
self.cur2.execute("insert into test(i) values (5)")
123121

122+
@unittest.skipIf(sqlite.sqlite_version_info < (3, 2, 2),
123+
'test hangs on sqlite versions older than 3.2.2')
124124
def CheckLocking(self):
125125
"""
126126
This tests the improved concurrency with pysqlite 2.3.4. You needed
127127
to roll back con2 before you could commit con1.
128128
"""
129-
if sqlite.sqlite_version_info < (3, 2, 2):
130-
# This will fail (hang) on earlier versions of sqlite.
131-
# Determine exact version it was fixed. 3.2.1 hangs.
132-
return
133129
self.cur1.execute("create table test(i)")
134130
self.cur1.execute("insert into test(i) values (5)")
135131
with self.assertRaises(sqlite.OperationalError):

‎Lib/sqlite3/test/types.py‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,11 +340,9 @@ def CheckSqliteTimestamp(self):
340340
ts2 = self.cur.fetchone()[0]
341341
self.assertEqual(ts, ts2)
342342

343+
@unittest.skipIf(sqlite.sqlite_version_info < (3, 1),
344+
'the date functions are available on 3.1 or later')
343345
def CheckSqlTimestamp(self):
344-
# The date functions are only available in SQLite version 3.1 or later
345-
if sqlite.sqlite_version_info < (3, 1):
346-
return
347-
348346
# SQLite's current_timestamp uses UTC time, while datetime.datetime.now() uses local time.
349347
now = datetime.datetime.now()
350348
self.cur.execute("insert into test(ts) values (current_timestamp)")

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL