mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Search for test files in sys.path
This commit is contained in:
parent
131e2abcd1
commit
b19d86232b
1 changed files with 10 additions and 0 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue