]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-95291: Use import helper to improve sqlite3 audit tests (#95292)
authorErlend Egeberg Aasland <erlend.aasland@protonmail.com>
Tue, 26 Jul 2022 19:18:16 +0000 (21:18 +0200)
committerGitHub <noreply@github.com>
Tue, 26 Jul 2022 19:18:16 +0000 (21:18 +0200)
Now the tests are correctly reported as skipped if sqlite3 is not available.

Lib/test/test_audit.py

index 6a025f39912e6774dc302f252eee0cd5524c60db..a7ff038c0936e865f78b3fa65bd3ede5051b0c5e 100644 (file)
@@ -155,10 +155,7 @@ class AuditTest(unittest.TestCase):
 
 
     def test_sqlite3(self):
-        try:
-            import sqlite3
-        except ImportError:
-            return
+        sqlite3 = import_helper.import_module("sqlite3")
         returncode, events, stderr = self.run_python("test_sqlite3")
         if returncode:
             self.fail(stderr)