From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 27 Jul 2022 08:07:32 +0000 (-0700) Subject: gh-95291: Use import helper to improve sqlite3 audit tests (GH-95292) (GH-95293) X-Git-Tag: v3.11.0rc1~89 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c72940a60994d6c1b3ae90b6d050bd747b074dde;p=thirdparty%2FPython%2Fcpython.git gh-95291: Use import helper to improve sqlite3 audit tests (GH-95292) (GH-95293) Now the tests are correctly reported as skipped if sqlite3 is not available. (cherry picked from commit 152eb90311fdf294510b5d077332580ba18c0ee4) Co-authored-by: Erlend Egeberg Aasland --- diff --git a/Lib/test/test_audit.py b/Lib/test/test_audit.py index 6a025f39912e..a7ff038c0936 100644 --- a/Lib/test/test_audit.py +++ b/Lib/test/test_audit.py @@ -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)