summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZachary Ware <zachary.ware@gmail.com>2013-12-16 15:02:41 (GMT)
committerZachary Ware <zachary.ware@gmail.com>2013-12-16 15:02:41 (GMT)
commit1007432c95acee46a09b08306ef1859b97a184b0 (patch)
tree409a0a9e2b121d232794bdb64257109742e4532b
parent928b9e272dae8c0740732a1c01f1bff72ded5ad5 (diff)
downloadcpython-1007432c95acee46a09b08306ef1859b97a184b0.zip
cpython-1007432c95acee46a09b08306ef1859b97a184b0.tar.gz
cpython-1007432c95acee46a09b08306ef1859b97a184b0.tar.bz2
Issue #19987: Re-write test_alias_fallback in test_winsound to have two
acceptable outcomes: success or RuntimeError. Without being able to actually hear whether a sound was played, either one could be right, but any other error would be a failure.
-rw-r--r--Lib/test/test_winsound.py15
-rw-r--r--Misc/NEWS2
2 files changed, 9 insertions, 8 deletions
diff --git a/Lib/test/test_winsound.py b/Lib/test/test_winsound.py
index 2759787..069adc3 100644
--- a/Lib/test/test_winsound.py
+++ b/Lib/test/test_winsound.py
@@ -158,14 +158,15 @@ class PlaySoundTest(unittest.TestCase):
)
def test_alias_fallback(self):
- if _have_soundcard():
+ # In the absense of the ability to tell if a sound was actually
+ # played, this test has two acceptable outcomes: success (no error,
+ # sound was theoretically played; although as issue #19987 shows
+ # a box without a soundcard can "succeed") or RuntimeError. Any
+ # other error is a failure.
+ try:
winsound.PlaySound('!"$%&/(#+*', winsound.SND_ALIAS)
- else:
- self.assertRaises(
- RuntimeError,
- winsound.PlaySound,
- '!"$%&/(#+*', winsound.SND_ALIAS
- )
+ except RuntimeError:
+ pass
def test_alias_nofallback(self):
if _have_soundcard():
diff --git a/Misc/NEWS b/Misc/NEWS
index b0c1e36..cacfb7c 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -160,7 +160,7 @@ Tests
- Issue #19926: Removed unneeded test_main from test_abstract_numbers.
Patch by Vajrasky Kok.
-- Issue #19595: Re-enabled a long-disabled test in test_winsound.
+- Issue #19595, #19987: Re-enabled a long-disabled test in test_winsound.
- Issue #19588: Fixed tests in test_random that were silently skipped most
of the time. Patch by Julian Gindi.