Skip to content

Commit e26aa24

Browse files
miss-islingtonambv
andauthored
gh-99659: Use correct exceptions in sqlite3 bigmem tests (GH-99660)
The tests in question were added in 0eec627 by Serhiy. Apparently, sqlite3 changed exceptions raised in those cases in the mean time but the tests never ran because they require a high `-M` setting in the test runner. (cherry picked from commit 2781ec9) Co-authored-by: Łukasz Langa <[email protected]>
1 parent 05147dc commit e26aa24

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Lib/test/test_sqlite3/test_types.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ def test_string_with_surrogates(self):
106106
@unittest.skipUnless(sys.maxsize > 2**32, 'requires 64bit platform')
107107
@support.bigmemtest(size=2**31, memuse=4, dry_run=False)
108108
def test_too_large_string(self, maxsize):
109-
with self.assertRaises(sqlite.InterfaceError):
109+
with self.assertRaises(sqlite.DataError):
110110
self.cur.execute("insert into test(s) values (?)", ('x'*(2**31-1),))
111-
with self.assertRaises(OverflowError):
111+
with self.assertRaises(sqlite.DataError):
112112
self.cur.execute("insert into test(s) values (?)", ('x'*(2**31),))
113113
self.cur.execute("select 1 from test")
114114
row = self.cur.fetchone()
@@ -117,9 +117,9 @@ def test_too_large_string(self, maxsize):
117117
@unittest.skipUnless(sys.maxsize > 2**32, 'requires 64bit platform')
118118
@support.bigmemtest(size=2**31, memuse=3, dry_run=False)
119119
def test_too_large_blob(self, maxsize):
120-
with self.assertRaises(sqlite.InterfaceError):
120+
with self.assertRaises(sqlite.DataError):
121121
self.cur.execute("insert into test(s) values (?)", (b'x'*(2**31-1),))
122-
with self.assertRaises(OverflowError):
122+
with self.assertRaises(sqlite.DataError):
123123
self.cur.execute("insert into test(s) values (?)", (b'x'*(2**31),))
124124
self.cur.execute("select 1 from test")
125125
row = self.cur.fetchone()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Optional big memory tests in ``test_sqlite3`` now catch the correct
2+
:exc:`sqlite.DataError` exception type in case of too large strings and/or
3+
blobs passed.

0 commit comments

Comments
 (0)