From: Trent Nelson Date: Tue, 18 Mar 2008 07:32:47 +0000 (+0000) Subject: The behaviour of winsound.Beep() seems to differ between different versions of Window... X-Git-Tag: v2.5.3c1~124 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=549171e1ab84e9812965050d25ab2e25dbb8d90a;p=python The behaviour of winsound.Beep() seems to differ between different versions of Windows when there's either: a) no sound card entirely b) legacy beep driver has been disabled c) the legacy beep driver has been uninstalled Sometimes RuntimeErrors are raised, sometimes they're not. If _have_soundcard() returns False, don't expect winsound.Beep() to raise a RuntimeError, as this clearly isn't the case, as demonstrated by the various Win32 XP buildbots. --- diff --git a/Lib/test/test_winsound.py b/Lib/test/test_winsound.py index 5606c44cc0..1c524c976e 100644 --- a/Lib/test/test_winsound.py +++ b/Lib/test/test_winsound.py @@ -26,8 +26,16 @@ class BeepTest(unittest.TestCase): winsound.Beep(37, 75) winsound.Beep(32767, 75) else: - self.assertRaises(RuntimeError, winsound.Beep, 37, 75) - self.assertRaises(RuntimeError, winsound.Beep, 32767, 75) + # The behaviour of winsound.Beep() seems to differ between + # different versions of Windows when there's either a) no + # sound card entirely, b) legacy beep driver has been disabled, + # or c) the legacy beep driver has been uninstalled. Sometimes + # RuntimeErrors are raised, sometimes they're not. Meh. + try: + winsound.Beep(37, 75) + winsound.Beep(32767, 75) + except RuntimeError: + pass def test_increasingfrequency(self): if _have_soundcard():