summaryrefslogtreecommitdiffstats
path: root/Lib/sqlite3
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@innova.no>2021-06-20 19:24:00 (GMT)
committerGitHub <noreply@github.com>2021-06-20 19:24:00 (GMT)
commit185ecdc1463c527743eeb16a5deef75c1985de79 (patch)
tree02e052896eb476d4f17ecad962dde1d0a1e9349c /Lib/sqlite3
parent09eb81711597725f853e4f3b659ce185488b0d8c (diff)
downloadcpython-185ecdc1463c527743eeb16a5deef75c1985de79.zip
cpython-185ecdc1463c527743eeb16a5deef75c1985de79.tar.gz
cpython-185ecdc1463c527743eeb16a5deef75c1985de79.tar.bz2
bpo-40956: Convert sqlite3.connect and sqlite3.Connection.__init__ to AC (GH-24421)
Diffstat (limited to 'Lib/sqlite3')
-rw-r--r--Lib/sqlite3/test/dbapi.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py
index 4bda6aa..2924231 100644
--- a/Lib/sqlite3/test/dbapi.py
+++ b/Lib/sqlite3/test/dbapi.py
@@ -27,6 +27,7 @@ import threading
import unittest
from test.support.os_helper import TESTFN, unlink
+from test.support import threading_helper
# Helper for tests using TESTFN
@@ -224,6 +225,10 @@ class OpenTests(unittest.TestCase):
with managed_connect(f"file:{TESTFN}?mode=ro", uri=True) as cx:
cx.execute(self._sql)
+ def test_database_keyword(self):
+ with sqlite.connect(database=":memory:") as cx:
+ self.assertEqual(type(cx), sqlite.Connection)
+
class CursorTests(unittest.TestCase):
def setUp(self):
@@ -724,6 +729,22 @@ class ThreadTests(unittest.TestCase):
if len(errors) > 0:
self.fail("\n".join(errors))
+ @threading_helper.reap_threads
+ def test_dont_check_same_thread(self):
+ def run(con, err):
+ try:
+ con.execute("select 1")
+ except sqlite.Error:
+ err.append("multi-threading not allowed")
+
+ con = sqlite.connect(":memory:", check_same_thread=False)
+ err = []
+ t = threading.Thread(target=run, kwargs={"con": con, "err": err})
+ t.start()
+ t.join()
+ self.assertEqual(len(err), 0, "\n".join(err))
+
+
class ConstructorTests(unittest.TestCase):
def test_date(self):
d = sqlite.Date(2004, 10, 28)