Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2495061

Browse files
committed
add script for moving good saved images to baseline
svn path=/trunk/matplotlib/; revision=7527
1 parent fd71b24 commit 2495061

2 files changed

Lines changed: 57 additions & 0 deletions

File tree

test/README.build_slaves

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
There can be two different types of build slaves: virtualenv and
2+
python source install with clean installs of numpy and mpl. Both of
3+
these will need nose installed.
4+

test/movegood.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import os, sys, glob, shutil
2+
import matplotlib.cbook as cbook
3+
4+
savedresults_dir = 'saved-results'
5+
baseline_dir = 'baseline'
6+
diff_dir = 'diff-images'
7+
basename = 'failed-diff-'
8+
nbase = len(basename)
9+
10+
failed = set()
11+
for fname in glob.glob(os.path.join(diff_dir, '%s*.png'%basename)):
12+
ind = fname.find(basename)
13+
fname = fname[ind+nbase:]
14+
failed.add(fname)
15+
16+
datad = dict()
17+
for fpath in cbook.get_recursive_filelist('.'):
18+
if not fpath.endswith('.png'): continue
19+
if fpath.find(diff_dir)>0: continue
20+
rel_dir, fname = os.path.split(fpath)
21+
22+
23+
saved = fpath.find(savedresults_dir)>0
24+
baseline = fpath.find(baseline_dir)>0
25+
26+
if saved:
27+
datad.setdefault(fname, [None,None])[0] = fpath
28+
elif baseline:
29+
datad.setdefault(fname, [None,None])[1] = fpath
30+
31+
nfailed = len(failed)
32+
for ithis, fname in enumerate(sorted(failed)):
33+
data = datad.get(fname)
34+
if data is not None:
35+
saved, baseline = data
36+
#print ithis, fname, saved, baseline
37+
if saved is None:
38+
print 'could not find saved data for', fname
39+
elif baseline is None:
40+
print 'could not find baseline data for', fname
41+
else:
42+
x = raw_input('Copy %d of %d\n saved="%s" to\n baseline="%s" (n|Y):'%(ithis, nfailed, saved, baseline))
43+
if x.lower()=='y' or x=='':
44+
shutil.copy(saved, baseline)
45+
print ' copied'
46+
elif x.lower()=='n':
47+
print ' skipping'
48+
else:
49+
print ' skipping unrecognized response="%s"'%x
50+
print
51+
52+
else:
53+
print 'could not find data for', fname

0 commit comments

Comments
 (0)