python-2.5.2/win32/Lib/test/test_sunaudiodev.py
changeset 0 ae805ac0140d
equal deleted inserted replaced
-1:000000000000 0:ae805ac0140d
       
     1 from test.test_support import verbose, findfile, TestFailed, TestSkipped
       
     2 import sunaudiodev
       
     3 import os
       
     4 
       
     5 try:
       
     6     audiodev = os.environ["AUDIODEV"]
       
     7 except KeyError:
       
     8     audiodev = "/dev/audio"
       
     9 
       
    10 if not os.path.exists(audiodev):
       
    11     raise TestSkipped("no audio device found!")
       
    12 
       
    13 def play_sound_file(path):
       
    14     fp = open(path, 'r')
       
    15     data = fp.read()
       
    16     fp.close()
       
    17     try:
       
    18         a = sunaudiodev.open('w')
       
    19     except sunaudiodev.error, msg:
       
    20         raise TestFailed, msg
       
    21     else:
       
    22         a.write(data)
       
    23         a.close()
       
    24 
       
    25 def test():
       
    26     play_sound_file(findfile('audiotest.au'))
       
    27 
       
    28 test()