summaryrefslogtreecommitdiff
path: root/Lib/test/test_sqlite3/test_dbapi.py
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@innova.no>2021-11-03 22:01:37 +0100
committerGitHub <noreply@github.com>2021-11-03 21:01:37 +0000
commitc2739867113a2b650db300c03ef06cf18dcee3f4 (patch)
tree859f757fe8859147d1efa51a86207771968c5a27 /Lib/test/test_sqlite3/test_dbapi.py
parent762173c6709f5cf3b59cbbe47d4e6fafbfe7ec2a (diff)
downloadcpython-git-c2739867113a2b650db300c03ef06cf18dcee3f4.tar.gz
bpo-45613: Set `sqlite3.threadsafety` dynamically (GH-29227)
Use the compile-time selected default SQLite threaded mode to set the DB-API 2.0 attribute 'threadsafety' Mappings: - SQLITE_THREADSAFE=0 => threadsafety=0 - SQLITE_THREADSAFE=1 => threadsafety=3 - SQLITE_THREADSAFE=2 => threadsafety=1
Diffstat (limited to 'Lib/test/test_sqlite3/test_dbapi.py')
-rw-r--r--Lib/test/test_sqlite3/test_dbapi.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_sqlite3/test_dbapi.py b/Lib/test/test_sqlite3/test_dbapi.py
index 998b7cb8c7..ba3652a04a 100644
--- a/Lib/test/test_sqlite3/test_dbapi.py
+++ b/Lib/test/test_sqlite3/test_dbapi.py
@@ -54,8 +54,9 @@ class ModuleTests(unittest.TestCase):
"apilevel is %s, should be 2.0" % sqlite.apilevel)
def test_thread_safety(self):
- self.assertEqual(sqlite.threadsafety, 1,
- "threadsafety is %d, should be 1" % sqlite.threadsafety)
+ self.assertIn(sqlite.threadsafety, {0, 1, 3},
+ "threadsafety is %d, should be 0, 1 or 3" %
+ sqlite.threadsafety)
def test_param_style(self):
self.assertEqual(sqlite.paramstyle, "qmark",