]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-25130: Make SQLite tests more compatible with PyPy (GH-28021)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 29 Aug 2021 10:43:48 +0000 (03:43 -0700)
committerGitHub <noreply@github.com>
Sun, 29 Aug 2021 10:43:48 +0000 (03:43 -0700)
(cherry picked from commit 07d3d54f4e84b1259b800884b202701f69e408d8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Lib/sqlite3/test/dbapi.py
Lib/sqlite3/test/regression.py

index 5d521d0cce5e1b62b3f02b0f7b25c67e4a955d82..a8dcd7e8bfeddbc0a1cdfbe676bf2bad8793920c 100644 (file)
@@ -398,6 +398,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 417a53109c87c72fbc43b956614e42d3486479c9..70d0ff9af10713a695c29d9639500ca6e274c11e 100644 (file)
@@ -125,11 +125,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 test_bind_mutating_list(self):
         # Issue41662: Crash when mutate a list of parameters during iteration.