diff options
author | Guido van Rossum <guido@python.org> | 1994-03-09 12:54:32 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1994-03-09 12:54:32 (GMT) |
commit | b19d86232b39bd20fe56d82d63e90e0b33c620e1 (patch) | |
tree | 77dc30aa27b572f7cefcd8e2c242cf07b1d1a859 /Lib/test | |
parent | 131e2abcd16d8673e157cf279dff563f2db402e7 (diff) | |
download | cpython-b19d86232b39bd20fe56d82d63e90e0b33c620e1.zip cpython-b19d86232b39bd20fe56d82d63e90e0b33c620e1.tar.gz cpython-b19d86232b39bd20fe56d82d63e90e0b33c620e1.tar.bz2 |
Search for test files in sys.path
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_rgbimg.py | 10 |
1 files changed, 10 insertions, 0 deletions
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: |