Issue #7051: Clarify behaviour of 'g' and 'G'-style formatting.
[python.git] / Lib / test / test_sunaudiodev.py
blobc96f711819fb96e01a6de3b19d44ab3a17643c6d
1 from test.test_support import findfile, TestFailed, import_module
2 import unittest
3 sunaudiodev = import_module('sunaudiodev', deprecated=True)
4 import os
6 try:
7 audiodev = os.environ["AUDIODEV"]
8 except KeyError:
9 audiodev = "/dev/audio"
11 if not os.path.exists(audiodev):
12 raise unittest.SkipTest("no audio device found!")
14 def play_sound_file(path):
15 fp = open(path, 'r')
16 data = fp.read()
17 fp.close()
18 try:
19 a = sunaudiodev.open('w')
20 except sunaudiodev.error, msg:
21 raise TestFailed, msg
22 else:
23 a.write(data)
24 a.close()
27 def test_main():
28 play_sound_file(findfile('audiotest.au'))
32 if __name__ == '__main__':
33 test_main()