From df23c878d08290c5f39e11dae0d5035f4de7870d Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Wed, 14 Feb 2024 12:31:00 +0100 Subject: [PATCH 1/3] gh-100414: Skip test_dbm_sqlite3 if sqlite3 is unavailable --- Lib/test/test_dbm_sqlite3.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_dbm_sqlite3.py b/Lib/test/test_dbm_sqlite3.py index 7bc2a030352835..7136b54016c28b 100644 --- a/Lib/test/test_dbm_sqlite3.py +++ b/Lib/test/test_dbm_sqlite3.py @@ -1,4 +1,3 @@ -import sqlite3 import sys import test.support import unittest @@ -7,8 +6,8 @@ from pathlib import Path from test.support import cpython_only, import_helper, os_helper - dbm_sqlite3 = import_helper.import_module("dbm.sqlite3") +import sqlite3 from dbm.sqlite3 import _normalize_uri From 767c8b07f0031aedeb8a0487ebe6d835874d04f1 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Wed, 14 Feb 2024 13:28:09 +0100 Subject: [PATCH 2/3] Update Lib/test/test_dbm_sqlite3.py Co-authored-by: Alex Waygood --- Lib/test/test_dbm_sqlite3.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/test/test_dbm_sqlite3.py b/Lib/test/test_dbm_sqlite3.py index 7136b54016c28b..0fa9bfab99f7ac 100644 --- a/Lib/test/test_dbm_sqlite3.py +++ b/Lib/test/test_dbm_sqlite3.py @@ -7,6 +7,9 @@ from test.support import cpython_only, import_helper, os_helper dbm_sqlite3 = import_helper.import_module("dbm.sqlite3") +# N.B. The test will fail if the sqlite3 import is above the import of dbm.sqlite3. +# This is deliberate: if the import helper managed to import dbm.sqlite3, +# we must inevitably be able to import sqlite3. Else, we have a problem. import sqlite3 from dbm.sqlite3 import _normalize_uri From d9a099c4cb4484196929a6d48efa823efda7a13a Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 14 Feb 2024 12:37:11 +0000 Subject: [PATCH 3/3] slight tweak --- Lib/test/test_dbm_sqlite3.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_dbm_sqlite3.py b/Lib/test/test_dbm_sqlite3.py index 0fa9bfab99f7ac..7a49fd2f924f8d 100644 --- a/Lib/test/test_dbm_sqlite3.py +++ b/Lib/test/test_dbm_sqlite3.py @@ -7,7 +7,8 @@ from test.support import cpython_only, import_helper, os_helper dbm_sqlite3 = import_helper.import_module("dbm.sqlite3") -# N.B. The test will fail if the sqlite3 import is above the import of dbm.sqlite3. +# N.B. The test will fail on some platforms without sqlite3 +# if the sqlite3 import is above the import of dbm.sqlite3. # This is deliberate: if the import helper managed to import dbm.sqlite3, # we must inevitably be able to import sqlite3. Else, we have a problem. import sqlite3