]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-114272: Allow _wmi audit test to succeed even if it times out (GH-114602)
authorSteve Dower <steve.dower@python.org>
Fri, 26 Jan 2024 14:38:24 +0000 (14:38 +0000)
committerGitHub <noreply@github.com>
Fri, 26 Jan 2024 14:38:24 +0000 (14:38 +0000)
Lib/test/audit-tests.py

index ce4a11b119c9007c64ac0f4c779b3434c05afc54..de7d0da560a1c79df17f345b44f10b80f1acceb8 100644 (file)
@@ -487,7 +487,13 @@ def test_wmi_exec_query():
             print(event, args[0])
 
     sys.addaudithook(hook)
-    _wmi.exec_query("SELECT * FROM Win32_OperatingSystem")
+    try:
+        _wmi.exec_query("SELECT * FROM Win32_OperatingSystem")
+    except WindowsError as e:
+        # gh-112278: WMI may be slow response when first called, but we still
+        # get the audit event, so just ignore the timeout
+        if e.winerror != 258:
+            raise
 
 def test_syslog():
     import syslog