[Python-checkins] gh-95291: Use import helper to improve sqlite3 audit tests (#95292)
erlend-aasland
webhook-mailer at python.org
Tue Jul 26 15:18:38 EDT 2022
https://github.com/python/cpython/commit/152eb90311fdf294510b5d077332580ba18c0ee4
commit: 152eb90311fdf294510b5d077332580ba18c0ee4
branch: main
author: Erlend Egeberg Aasland <erlend.aasland at protonmail.com>
committer: erlend-aasland <erlend.aasland at protonmail.com>
date: 2022-07-26T21:18:16+02:00
summary:
gh-95291: Use import helper to improve sqlite3 audit tests (#95292)
Now the tests are correctly reported as skipped if sqlite3 is not available.
files:
M Lib/test/test_audit.py
diff --git a/Lib/test/test_audit.py b/Lib/test/test_audit.py
index 6a025f39912e6..a7ff038c0936e 100644
--- a/Lib/test/test_audit.py
+++ b/Lib/test/test_audit.py
@@ -155,10 +155,7 @@ def test_http(self):
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)
More information about the Python-checkins
mailing list