From b19d86232b39bd20fe56d82d63e90e0b33c620e1 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 9 Mar 1994 12:54:32 +0000 Subject: Search for test files in sys.path --- Lib/test/test_rgbimg.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Lib/test/test_rgbimg.py b/Lib/test/test_rgbimg.py index 7418e69..cdadc66 100644 --- a/Lib/test/test_rgbimg.py +++ b/Lib/test/test_rgbimg.py @@ -6,7 +6,17 @@ error = 'test_rgbimg.error' print 'RGBimg test suite:' +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 testimg(rgb_file, raw_file): + rgb_file = findfile(rgb_file) + raw_file = findfile(raw_file) width, height = rgbimg.sizeofimage(rgb_file) rgb = rgbimg.longimagedata(rgb_file) if len(rgb) != width * height * 4: -- cgit v0.12