Kaydet (Commit) b241c421 authored tarafından Barry Warsaw's avatar Barry Warsaw

A slightly better test of sunaudiodev module. Include the audio data

in the distribution.
üst dbfb8d46
This diff was suppressed by a .gitattributes entry.
...@@ -2,10 +2,13 @@ from test_support import verbose, TestFailed ...@@ -2,10 +2,13 @@ from test_support import verbose, TestFailed
import sunaudiodev import sunaudiodev
import os import os
OS_AUDIO_DIRS = [ def findfile(file):
'/usr/demo/SOUND/sounds/', # Solaris 2.x 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): def play_sound_file(path):
fp = open(path, 'r') fp = open(path, 'r')
...@@ -16,23 +19,7 @@ def play_sound_file(path): ...@@ -16,23 +19,7 @@ def play_sound_file(path):
a.close() a.close()
def test(): def test():
for d in OS_AUDIO_DIRS: print os.getcwd()
try: play_sound_file(findfile('audiotest.au'))
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"
test() test()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment