summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sunaudiodev.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1997-01-13 20:34:44 (GMT)
committerBarry Warsaw <barry@python.org>1997-01-13 20:34:44 (GMT)
commitb241c4219297ed4589e38e2cc48daf7504c0f3bf (patch)
tree78b799d03cbf1bead1d6fbe26a22723dac244475 /Lib/test/test_sunaudiodev.py
parentdbfb8d46260e29d2ca3068174aeeadced057b5fe (diff)
downloadcpython-b241c4219297ed4589e38e2cc48daf7504c0f3bf.zip
cpython-b241c4219297ed4589e38e2cc48daf7504c0f3bf.tar.gz
cpython-b241c4219297ed4589e38e2cc48daf7504c0f3bf.tar.bz2
A slightly better test of sunaudiodev module. Include the audio data
in the distribution.
Diffstat (limited to 'Lib/test/test_sunaudiodev.py')
-rw-r--r--Lib/test/test_sunaudiodev.py31
1 files changed, 9 insertions, 22 deletions
diff --git a/Lib/test/test_sunaudiodev.py b/Lib/test/test_sunaudiodev.py
index 586cfb9..4f3b774 100644
--- a/Lib/test/test_sunaudiodev.py
+++ b/Lib/test/test_sunaudiodev.py
@@ -2,10 +2,13 @@ from test_support import verbose, TestFailed
import sunaudiodev
import os
-OS_AUDIO_DIRS = [
- '/usr/demo/SOUND/sounds/', # Solaris 2.x
- ]
-
+def findfile(file):
+ if os.path.isabs(file): return file
+ import sys
+ for dn in sys.path:
+ fn = os.path.join(dn, file)
+ if os.path.exists(fn): return fn
+ return file
def play_sound_file(path):
fp = open(path, 'r')
@@ -16,23 +19,7 @@ def play_sound_file(path):
a.close()
def test():
- for d in OS_AUDIO_DIRS:
- try:
- files = os.listdir(d)
- break
- except os.error:
- pass
- else:
- # test couldn't be conducted on this platform
- raise ImportError
- for f in files:
- path = os.path.join(d, f)
- try:
- play_sound_file(path)
- break
- except:
- pass
- else:
- raise TestFailed, "couldn't play any sounds"
+ print os.getcwd()
+ play_sound_file(findfile('audiotest.au'))
test()