]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-95291: Use import helper to improve sqlite3 audit tests (GH-95292)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 26 Jul 2022 19:40:59 +0000 (12:40 -0700)
committerGitHub <noreply@github.com>
Tue, 26 Jul 2022 19:40:59 +0000 (12:40 -0700)
Now the tests are correctly reported as skipped if sqlite3 is not available.
(cherry picked from commit 152eb90311fdf294510b5d077332580ba18c0ee4)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
Lib/test/test_audit.py

index c5ce26323b5f9ec6015d623549420de3727e3980..04c9d6b85539aa563b787b39a5d213038cc4690d 100644 (file)
@@ -152,10 +152,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)