From b241c4219297ed4589e38e2cc48daf7504c0f3bf Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Mon, 13 Jan 1997 20:34:44 +0000 Subject: A slightly better test of sunaudiodev module. Include the audio data in the distribution. --- Lib/test/audiotest.au | Bin 0 -> 20922 bytes Lib/test/test_sunaudiodev.py | 31 +++++++++---------------------- 2 files changed, 9 insertions(+), 22 deletions(-) create mode 100644 Lib/test/audiotest.au diff --git a/Lib/test/audiotest.au b/Lib/test/audiotest.au new file mode 100644 index 0000000..3077fdd Binary files /dev/null and b/Lib/test/audiotest.au differ 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() -- cgit v0.12