Remove copyTestFiles()

main
LeoHsiao 5 years ago
parent 2778125b79
commit d1cb43f360

@ -17,7 +17,7 @@ class TestCases(unittest.TestCase):
def test_addmoddel(self):
# Test driver to run the addmoddel sample program
jpg = 'exiv2-empty.jpg'
BT.copyTestFiles(jpg)
BT.copyTestFile(jpg)
out = BT.excute('addmoddel {jpg}', vars())
out += BT.excute('exiv2 -pv {jpg}', vars())
out += ['']
@ -279,60 +279,90 @@ set Exif.Photo.DateTimeDigitized 2020:05:26 07:31:42'''
BT.reportTest('exifdata-test', out)
def test_geotag(self):
# Test driver for geotag
jpg = 'FurnaceCreekInn.jpg'
gpx = 'FurnaceCreekInn.gpx'
for i in [jpg, gpx]:
BT.copyTestFile(i)
out = ['--- show GPSInfo tags ---']
out += BT.excute('exiv2 -pa --grep GPSInfo {jpg}', vars())
out += ['--- deleting the GPSInfo tags']
for tag in BT.excute('exiv2 -Pk --grep GPSInfo {jpg}', vars()):
tag = tag.rstrip(' ')
out += BT.excute('exiv2 -M"del {tag}" {jpg}', vars())
out += BT.excute('exiv2 -pa --grep GPS {jpg}', vars(), expected_returncodes=[0, 1])
out += ['--- run geotag ---']
geotag_out = BT.excute('geotag -ascii -tz -8:00 {jpg} {gpx}', vars())
geotag_out = geotag_out[0].split(' ')[1:]
out += [' '.join(geotag_out)]
out += ['--- show GPSInfo tags ---']
out += BT.excute('exiv2 -pa --grep GPSInfo {jpg}', vars())
out += ['']
BT.reportTest('geotag-test', out)
def test_icc(self):
# Test driver for exiv2.exe ICC support (-pS, -pC, -eC, -iC)
def test1120(filename):
def test1120(img):
# --comment and -dc clobbered by writing ICC/JPG
if filename == 'Reagan2.jp2':
if img == 'Reagan2.jp2':
return []
if filename == 'exiv2-bug1199.webp':
out = BT.excute('exiv2 --comment abcdefg {filename}', vars(), expected_returncodes=[0,1])
out += BT.excute('exiv2 -pS {filename}', vars())
if img == 'exiv2-bug1199.webp':
out = BT.excute('exiv2 --comment abcdefg {img}', vars(), expected_returncodes=[0,1])
out += BT.excute('exiv2 -pS {img}', vars())
out += ['']
else:
out = BT.excute('exiv2 --comment abcdefg {filename}', vars())
out += BT.excute('exiv2 -pS {filename}', vars())
out += BT.excute('exiv2 -pc {filename}', vars())
out += BT.excute('exiv2 -dc {filename}', vars())
out += BT.excute('exiv2 -pS {filename}', vars())
out = BT.excute('exiv2 --comment abcdefg {img}', vars())
out += BT.excute('exiv2 -pS {img}', vars())
out += BT.excute('exiv2 -pc {img}', vars())
out += BT.excute('exiv2 -dc {img}', vars())
out += BT.excute('exiv2 -pS {img}', vars())
return out or []
# num = 1074 # ICC Profile Support
out = []
for filename in ['Reagan.jpg',
for img in ['Reagan.jpg',
'exiv2-bug1199.webp',
'ReaganLargePng.png',
'ReaganLargeJpg.jpg',
'Reagan2.jp2']: # 1272 ReaganLargeTiff.tiff
stub = filename.split('.')[0]
stub = img.split('.')[0]
iccname = stub + '.icc'
BT.copyTestFiles('large.icc', 'small.icc', filename)
out += BT.excute('exiv2 -pS {filename}', vars())
icc_bytes = BT.excute('exiv2 -pC {filename}', vars(), return_bytes=True)
for i in ['large.icc', 'small.icc', img]:
BT.copyTestFile(i)
out += BT.excute('exiv2 -pS {img}', vars())
icc_bytes = BT.excute('exiv2 -pC {img}', vars(), return_bytes=True)
BT.save(icc_bytes, stub + '_1.icc')
out += BT.excute('exiv2 -eC --force {filename}', vars())
out += BT.excute('exiv2 -eC --force {img}', vars())
BT.mv(iccname, stub + '_2.icc')
out += test1120(filename)
out += test1120(img)
BT.copyTestFile('large.icc', iccname)
out += BT.excute('exiv2 -iC {filename}', vars())
icc_bytes = BT.excute('exiv2 -pC {filename}', vars(), return_bytes=True)
out += BT.excute('exiv2 -iC {img}', vars())
icc_bytes = BT.excute('exiv2 -pC {img}', vars(), return_bytes=True)
BT.save(icc_bytes, stub + '_large_1.icc')
out += BT.excute('exiv2 -pS {filename}', vars())
out += BT.excute('exiv2 -eC --force {filename}', vars())
out += BT.excute('exiv2 -pS {img}', vars())
out += BT.excute('exiv2 -eC --force {img}', vars())
BT.mv(iccname, stub + '_large_2.icc')
out += test1120(filename)
out += test1120(img)
BT.copyTestFile('small.icc', iccname)
out += BT.excute('exiv2 -iC {filename}', vars())
icc_bytes = BT.excute('exiv2 -pC {filename}', vars(), return_bytes=True)
out += BT.excute('exiv2 -iC {img}', vars())
icc_bytes = BT.excute('exiv2 -pC {img}', vars(), return_bytes=True)
BT.save(icc_bytes, stub + '_small_1.icc')
out += BT.excute('exiv2 -pS {filename}', vars())
out += BT.excute('exiv2 -eC --force {filename}', vars())
out += BT.excute('exiv2 -pS {img}', vars())
out += BT.excute('exiv2 -eC --force {img}', vars())
BT.mv(iccname, stub + '_small_2.icc')
out += test1120(filename)
out += test1120(img)
for f in [stub, stub + '_small', stub + '_large']:
for i in [1, 2]:
@ -342,38 +372,11 @@ set Exif.Photo.DateTimeDigitized 2020:05:26 07:31:42'''
BT.reportTest('icc-test', out)
def test_geotag(self):
# Test driver for geotag
jpg = 'FurnaceCreekInn.jpg'
gpx = 'FurnaceCreekInn.gpx'
BT.copyTestFiles(jpg, gpx)
out = ['--- show GPSInfo tags ---']
out += BT.excute('exiv2 -pa --grep GPSInfo {jpg}', vars())
out += ['--- deleting the GPSInfo tags']
for tag in BT.excute('exiv2 -Pk --grep GPSInfo {jpg}', vars()):
tag = tag.rstrip(' ')
out += BT.excute('exiv2 -M"del {tag}" {jpg}', vars())
out += BT.excute('exiv2 -pa --grep GPS {jpg}', vars(), expected_returncodes=[0, 1])
out += ['--- run geotag ---']
geotag_out = BT.excute('geotag -ascii -tz -8:00 {jpg} {gpx}', vars())
geotag_out = geotag_out[0].split(' ')[1:]
out += [' '.join(geotag_out)]
out += ['--- show GPSInfo tags ---']
out += BT.excute('exiv2 -pa --grep GPSInfo {jpg}', vars())
out += ['']
BT.reportTest('geotag-test', out)
def test_io(self):
# Test driver for file i/o
test_files = ['table.jpg', 'smiley2.jpg', 'ext.dat']
BT.copyTestFiles(*test_files)
for f in test_files:
BT.copyTestFile(f)
BT.ioTest(f)
# Test http I/O

@ -131,12 +131,6 @@ def copyTestFile(src, dest=''):
os.path.join(Conf.tmp_dir, dest))
def copyTestFiles(*files):
""" Copy one or more test files from data_dir to tmp_dir """
for i in files:
copyTestFile(i)
def md5sum(filename):
""" Calculate the MD5 value of the file """
with open(filename, "rb") as f:

Loading…
Cancel
Save