]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Search for test files in sys.path
authorGuido van Rossum <guido@python.org>
Wed, 9 Mar 1994 12:54:32 +0000 (12:54 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 9 Mar 1994 12:54:32 +0000 (12:54 +0000)
Lib/test/test_rgbimg.py

index 7418e698682e24bd45c66cbc3e153efe2b83d3b0..cdadc660dd5f59bdfe62da162de1e4080565d50b 100644 (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: