From 02280d1417aa8f8ae9864ac478107bb1fb6195e7 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Wed, 24 Apr 2013 21:48:03 +0000 Subject: [PATCH] [Test] Display details about failed CSV comparisons --- site_scons/buildutils.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/site_scons/buildutils.py b/site_scons/buildutils.py index 8cb9bf5df..b9ccf38dc 100644 --- a/site_scons/buildutils.py +++ b/site_scons/buildutils.py @@ -9,6 +9,7 @@ import difflib import time import types import shutil +import itertools import SCons.Errors @@ -329,8 +330,16 @@ def compareCsvFiles(env, file1, file2): tol = env['test_csv_tolerance'] if maxerror > tol: # Threshold based on printing 6 digits in the CSV file - print ("Files differ. %i / %i elements above specified tolerance" % - (np.sum(relerror > tol), relerror.size)) + print ("Files differ. %i / %i elements above specified tolerance (%f)" % + (np.sum(relerror > tol), relerror.size, tol)) + print ' row col reference test rel. error' + print ' ---- ---- ------------ ------------ ----------' + for i,j in itertools.product(*map(range, relerror.shape)): + if relerror[i,j] > tol: + row = i + headerRows + 1 + col = j + 1 + print (' % 4i % 4i % 12f % 12f % 10f' % + (row, col, data1[i,j], data2[i,j], relerror[i,j])) return 1 else: return 0