[Python-checkins] CVS: python/dist/src/Lib/test test_sunaudiodev.py,1.9,1.10

Fred L. Drake fdrake@users.sourceforge.net
Fri, 13 Apr 2001 20:10:14 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv8259/Lib/test

Modified Files:
	test_sunaudiodev.py 
Log Message:

If the sunaudiodev module is available but we cannot find an audio
device to use, skip this test instead of allowing an error to occur
when we attempt to play sound on the absent device.

Verified by Mark Favas.


Index: test_sunaudiodev.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sunaudiodev.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** test_sunaudiodev.py	2001/01/17 21:51:36	1.9
--- test_sunaudiodev.py	2001/04/14 03:10:12	1.10
***************
*** 1,5 ****
! from test_support import verbose, findfile, TestFailed
  import sunaudiodev
  import os
  
  def play_sound_file(path):
--- 1,13 ----
! from test_support import verbose, findfile, TestFailed, TestSkipped
  import sunaudiodev
  import os
+ 
+ try:
+     audiodev = os.environ["AUDIODEV"]
+ except KeyError:
+     audiodev = "/dev/audio"
+ 
+ if not os.path.exists(audiodev):
+     raise TestSkipped("no audio device found!")
  
  def play_sound_file(path):