[Python-checkins] r61510 - in python: branches/release25-maint/Lib/test/test_winsound.py trunk/Lib/test/test_winsound.py

trent.nelson python-checkins at python.org
Tue Mar 18 08:32:47 CET 2008


Author: trent.nelson
Date: Tue Mar 18 08:32:47 2008
New Revision: 61510

Modified:
   python/branches/release25-maint/Lib/test/test_winsound.py
   python/trunk/Lib/test/test_winsound.py
Log:
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.

Modified: python/branches/release25-maint/Lib/test/test_winsound.py
==============================================================================
--- python/branches/release25-maint/Lib/test/test_winsound.py	(original)
+++ python/branches/release25-maint/Lib/test/test_winsound.py	Tue Mar 18 08:32:47 2008
@@ -26,8 +26,16 @@
             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():

Modified: python/trunk/Lib/test/test_winsound.py
==============================================================================
--- python/trunk/Lib/test/test_winsound.py	(original)
+++ python/trunk/Lib/test/test_winsound.py	Tue Mar 18 08:32:47 2008
@@ -26,8 +26,16 @@
             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():


More information about the Python-checkins mailing list