diff options
| author | Zachary Ware <zachary.ware@gmail.com> | 2013-12-16 14:58:10 (GMT) |
|---|---|---|
| committer | Zachary Ware <zachary.ware@gmail.com> | 2013-12-16 14:58:10 (GMT) |
| commit | 51e90bcee502499e4f7fcda9a55b5311b911c934 (patch) | |
| tree | 730181da2fa06ff6b55327175dd6803ed96dfaa6 /Lib/test/test_winsound.py | |
| parent | 4d39df35d7d72e0796c221674f0d507c5df62f19 (diff) | |
| download | cpython-51e90bcee502499e4f7fcda9a55b5311b911c934.zip cpython-51e90bcee502499e4f7fcda9a55b5311b911c934.tar.gz cpython-51e90bcee502499e4f7fcda9a55b5311b911c934.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.
Diffstat (limited to 'Lib/test/test_winsound.py')
| -rw-r--r-- | Lib/test/test_winsound.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Lib/test/test_winsound.py b/Lib/test/test_winsound.py index 6d8649a..4208fe7 100644 --- a/Lib/test/test_winsound.py +++ b/Lib/test/test_winsound.py @@ -159,14 +159,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(): |
