Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 50a5dad

Browse files
committed
Issue #19595: Re-enable a long-disabled test in test_winsound
1 parent 23bdd83 commit 50a5dad

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

Lib/test/test_winsound.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -158,18 +158,14 @@ def test_alias_question(self):
158158
)
159159

160160
def test_alias_fallback(self):
161-
# This test can't be expected to work on all systems. The MS
162-
# PlaySound() docs say:
163-
#
164-
# If it cannot find the specified sound, PlaySound uses the
165-
# default system event sound entry instead. If the function
166-
# can find neither the system default entry nor the default
167-
# sound, it makes no sound and returns FALSE.
168-
#
169-
# It's known to return FALSE on some real systems.
170-
171-
# winsound.PlaySound('!"$%&/(#+*', winsound.SND_ALIAS)
172-
return
161+
if _have_soundcard():
162+
winsound.PlaySound('!"$%&/(#+*', winsound.SND_ALIAS)
163+
else:
164+
self.assertRaises(
165+
RuntimeError,
166+
winsound.PlaySound,
167+
'!"$%&/(#+*', winsound.SND_ALIAS
168+
)
173169

174170
def test_alias_nofallback(self):
175171
if _have_soundcard():

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Library
3131
Tests
3232
-----
3333

34+
- Issue #19595: Re-enabled a long-disabled test in test_winsound.
35+
3436
- Issue #19588: Fixed tests in test_random that were silently skipped most
3537
of the time. Patch by Julian Gindi.
3638

0 commit comments

Comments
 (0)