Skip to content

Commit 442a299

Browse files
authored
gh-114272: Allow _wmi audit test to succeed even if it times out (GH-114602)
1 parent 30b7b4f commit 442a299

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Lib/test/audit-tests.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,13 @@ def hook(event, args):
487487
print(event, args[0])
488488

489489
sys.addaudithook(hook)
490-
_wmi.exec_query("SELECT * FROM Win32_OperatingSystem")
490+
try:
491+
_wmi.exec_query("SELECT * FROM Win32_OperatingSystem")
492+
except WindowsError as e:
493+
# gh-112278: WMI may be slow response when first called, but we still
494+
# get the audit event, so just ignore the timeout
495+
if e.winerror != 258:
496+
raise
491497

492498
def test_syslog():
493499
import syslog

0 commit comments

Comments
 (0)