]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.9] bpo-25130: Make SQLite tests more compatible with PyPy (GH-28021) (GH-28023)
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 29 Aug 2021 11:03:11 +0000 (14:03 +0300)
committerGitHub <noreply@github.com>
Sun, 29 Aug 2021 11:03:11 +0000 (14:03 +0300)
(cherry picked from commit 07d3d54)

Lib/sqlite3/test/backup.py
Lib/sqlite3/test/dbapi.py
Lib/sqlite3/test/regression.py

index ad1da9721527c2be86057b072194fc90a4774e84..6a772c64b2dfbcac7189e43a0126efff27013c46 100644 (file)
@@ -150,7 +150,8 @@ class BackupTests(unittest.TestCase):
                 self.cx.backup(bck, name='non-existing')
         self.assertIn(
             str(cm.exception),
-            ['SQL logic error', 'SQL logic error or missing database']
+            ['SQL logic error', 'SQL logic error or missing database',
+             'unknown database non-existing']
         )
 
         self.cx.execute("ATTACH DATABASE ':memory:' AS attached_db")
index 38e9fbd9d1dd609dab4fd765e26a1c7c8c007ae7..d00b60cac4e389449ce92f9a6f547e5e86c6b5ba 100644 (file)
@@ -395,6 +395,9 @@ class CursorTests(unittest.TestCase):
             def __init__(self):
                 self.value = 5
 
+            def __iter__(self):
+                return self
+
             def __next__(self):
                 if self.value == 10:
                     raise StopIteration
index 6aa86d5766e56843a836d5e6a1edaa6ad11ee9aa..6ba33564795536a6b5e075cee11bf23458d8c1f3 100644 (file)
@@ -127,11 +127,11 @@ class RegressionTests(unittest.TestCase):
         con = sqlite.connect(":memory:",detect_types=sqlite.PARSE_DECLTYPES)
         con.execute("create table foo(bar timestamp)")
         con.execute("insert into foo(bar) values (?)", (datetime.datetime.now(),))
-        con.execute(SELECT)
+        con.execute(SELECT).close()
         con.execute("drop table foo")
         con.execute("create table foo(bar integer)")
         con.execute("insert into foo(bar) values (5)")
-        con.execute(SELECT)
+        con.execute(SELECT).close()
 
     def CheckBindMutatingList(self):
         # Issue41662: Crash when mutate a list of parameters during iteration.