0001 from test.test_support import verbose, findfile, TestFailed, TestSkipped 0002 import sunaudiodev 0003 import os 0004 0005 try: 0006 audiodev = os.environ["AUDIODEV"] 0007 except KeyError: 0008 audiodev = "/dev/audio" 0009 0010 if not os.path.exists(audiodev): 0011 raise TestSkipped("no audio device found!") 0012 0013 def play_sound_file(path): 0014 fp = open(path, 'r') 0015 data = fp.read() 0016 fp.close() 0017 try: 0018 a = sunaudiodev.open('w') 0019 except sunaudiodev.error, msg: 0020 raise TestFailed, msg 0021 else: 0022 a.write(data) 0023 a.close() 0024 0025 def test(): 0026 play_sound_file(findfile('audiotest.au')) 0027 0028 test() 0029
Generated by PyXR 0.9.4