]> git.proxmox.com Git - mirror_edk2.git/blame - AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_sunaudiodev.py
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Lib / test / test_sunaudiodev.py
CommitLineData
4710c53d 1from test.test_support import findfile, TestFailed, import_module\r
2import unittest\r
3sunaudiodev = import_module('sunaudiodev', deprecated=True)\r
4import os\r
5\r
6try:\r
7 audiodev = os.environ["AUDIODEV"]\r
8except KeyError:\r
9 audiodev = "/dev/audio"\r
10\r
11if not os.path.exists(audiodev):\r
12 raise unittest.SkipTest("no audio device found!")\r
13\r
14def play_sound_file(path):\r
15 fp = open(path, 'r')\r
16 data = fp.read()\r
17 fp.close()\r
18 try:\r
19 a = sunaudiodev.open('w')\r
20 except sunaudiodev.error, msg:\r
21 raise TestFailed, msg\r
22 else:\r
23 a.write(data)\r
24 a.close()\r
25\r
26\r
27def test_main():\r
28 play_sound_file(findfile('audiotest.au'))\r
29\r
30\r
31\r
32if __name__ == '__main__':\r
33 test_main()\r