bpo-43434: Move sqlite3.connect audit events to sqlite3.Connection.__init__ (GH-25818)
diff --git a/Lib/test/audit-tests.py b/Lib/test/audit-tests.py
index ed42451..7a7de63 100644
--- a/Lib/test/audit-tests.py
+++ b/Lib/test/audit-tests.py
@@ -367,13 +367,14 @@ def hook(event, *args):
print(event, *args)
sys.addaudithook(hook)
- cx = sqlite3.connect(":memory:")
+ cx1 = sqlite3.connect(":memory:")
+ cx2 = sqlite3.Connection(":memory:")
# Configured without --enable-loadable-sqlite-extensions
if hasattr(sqlite3.Connection, "enable_load_extension"):
- cx.enable_load_extension(False)
+ cx1.enable_load_extension(False)
try:
- cx.load_extension("test")
+ cx1.load_extension("test")
except sqlite3.OperationalError:
pass
else:
diff --git a/Lib/test/test_audit.py b/Lib/test/test_audit.py
index 4ba62c4..25ff34b 100644
--- a/Lib/test/test_audit.py
+++ b/Lib/test/test_audit.py
@@ -158,7 +158,7 @@ def test_sqlite3(self):
if support.verbose:
print(*events, sep='\n')
actual = [ev[0] for ev in events]
- expected = ["sqlite3.connect", "sqlite3.connect/handle"]
+ expected = ["sqlite3.connect", "sqlite3.connect/handle"] * 2
if hasattr(sqlite3.Connection, "enable_load_extension"):
expected += [