diff options
author | Fred Drake <fdrake@acm.org> | 2001-04-14 03:10:12 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2001-04-14 03:10:12 (GMT) |
commit | b891891d005c4c98bb747271fb7c3e8fe23671a5 (patch) | |
tree | 4ac9e97efb34a164a2327ceb2ff0cd3f43bf09d5 /Lib/test/test_sunaudiodev.py | |
parent | 9cb98572af1ddfd4efbb6d97220c316e6fa95fda (diff) | |
download | cpython-b891891d005c4c98bb747271fb7c3e8fe23671a5.zip cpython-b891891d005c4c98bb747271fb7c3e8fe23671a5.tar.gz cpython-b891891d005c4c98bb747271fb7c3e8fe23671a5.tar.bz2 |
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.
Diffstat (limited to 'Lib/test/test_sunaudiodev.py')
-rw-r--r-- | Lib/test/test_sunaudiodev.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_sunaudiodev.py b/Lib/test/test_sunaudiodev.py index af18761..4864ec5 100644 --- a/Lib/test/test_sunaudiodev.py +++ b/Lib/test/test_sunaudiodev.py @@ -1,7 +1,15 @@ -from test_support import verbose, findfile, TestFailed +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): fp = open(path, 'r') data = fp.read() |