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

Skip to content

Commit 13eae44

Browse files
committed
testing: collect new image results on failed image comparisons
svn path=/trunk/matplotlib/; revision=7653
1 parent e2f8829 commit 13eae44

2 files changed

Lines changed: 30 additions & 3 deletions

File tree

lib/matplotlib/testing/compare.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import operator
88
import os
99
import numpy as np
10+
import shutil
1011

1112
#=======================================================================
1213

@@ -121,6 +122,7 @@ def compare_images( expected, actual, tol, in_decorator=False ):
121122
save_diff_image( expected, actual, diff_image )
122123

123124
if in_decorator:
125+
shutil.copyfile( expected, 'expected-'+os.path.basename(actual))
124126
results = dict(
125127
rms = rms,
126128
expected = str(expected),

test/_buildbot_test_postmortem.py

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
roots = ['test_matplotlib','test_plots']
1010
savedresults_dir = 'saved-results'
1111
baseline_dir = 'baseline'
12-
basename = 'failed-diff-'
12+
expected_basename = 'expected-'
13+
diff_basename = 'failed-diff-'
1314
target_dir = os.path.abspath('status_images')
14-
nbase = len(basename)
15+
nbase = len(diff_basename)
1516

1617
def listFiles(root, patterns='*', recurse=1, return_folders=0):
1718
"""
@@ -76,7 +77,31 @@ def path_split_all(fname):
7677
if os.path.exists(target_dir):
7778
shutil.rmtree(target_dir)
7879
os.makedirs( target_dir ) # prevent buildbot DirectoryUpload failure
80+
81+
# new matplotlib.testing infrastructure
82+
7983
os.chdir('test')
84+
for fname in glob.glob('*.png'):
85+
absdiff_fname = diff_basename + fname
86+
expected_fname = expected_basename + fname
87+
if not os.path.exists(absdiff_fname):
88+
continue
89+
if not os.path.exists(expected_fname):
90+
continue
91+
print fname
92+
print absdiff_fname
93+
94+
teststr = os.path.splitext(fname)[0]
95+
this_targetdir = os.path.join(target_dir,teststr)
96+
os.makedirs( this_targetdir )
97+
shutil.copy( expected_fname,
98+
os.path.join(this_targetdir,'baseline.png') )
99+
shutil.copy( fname,
100+
os.path.join(this_targetdir,'actual.png') )
101+
shutil.copy( absdiff_fname,
102+
os.path.join(this_targetdir,'absdiff.png') )
103+
104+
# old mplTest infrastructure
80105
for fpath in get_recursive_filelist(roots):
81106
# only images
82107
if not fpath.endswith('.png'): continue
@@ -87,7 +112,7 @@ def path_split_all(fname):
87112
root = pieces[0]
88113
testclass = pieces[2]
89114
fname = pieces[3]
90-
if not fname.startswith(basename):
115+
if not fname.startswith(diff_basename):
91116
# only failed images
92117
continue
93118
origname = fname[nbase:]

0 commit comments

Comments
 (0)