Search for test files in sys.path

This commit is contained in:
Guido van Rossum 1994-03-09 12:54:32 +00:00
parent 131e2abcd1
commit b19d86232b

View file

@ -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: