]> granicus.if.org Git - python/commitdiff
Don't require that a RuntimeError is raised when playing a second
authorWalter Dörwald <walter@livinglogic.de>
Mon, 30 Jun 2003 11:57:52 +0000 (11:57 +0000)
committerWalter Dörwald <walter@livinglogic.de>
Mon, 30 Jun 2003 11:57:52 +0000 (11:57 +0000)
sound while the first one is still running, as the first one
one might already have finished.

Fixes part of SF bug #763052.

Lib/test/test_winsound.py

index def8c877fab98389640d6a59f3a669183717e481..7e1459947ae30ce4f3cee93571841a5e40ff5918 100644 (file)
@@ -88,11 +88,15 @@ class PlaySoundTest(unittest.TestCase):
             winsound.SND_ALIAS | winsound.SND_ASYNC | winsound.SND_LOOP
         )
         time.sleep(0.5)
-        self.assertRaises(
-            RuntimeError,
-            winsound.PlaySound,
-            'SystemQuestion', winsound.SND_ALIAS | winsound.SND_NOSTOP
-        )
+        try:
+            winsound.PlaySound(
+                'SystemQuestion',
+                winsound.SND_ALIAS | winsound.SND_NOSTOP
+            )
+        except RuntimeError:
+            pass
+        else: # the first sound might already be finished
+            pass
         winsound.PlaySound(None, winsound.SND_PURGE)
 
 def test_main():