aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-12-26 20:15:58 -0500
committerDavid Robillard <d@drobilla.net>2017-12-29 10:56:53 -0500
commit5d1b33259ae5ea31a71d0ec4ef9a4b546a771564 (patch)
tree36791509cf51df2b7a5393135860b658297cf2c0
parent1a03e92bfb0c232ba836e8259622fb8bf1d5daf1 (diff)
downloadserd-5d1b33259ae5ea31a71d0ec4ef9a4b546a771564.tar.gz
serd-5d1b33259ae5ea31a71d0ec4ef9a4b546a771564.tar.bz2
serd-5d1b33259ae5ea31a71d0ec4ef9a4b546a771564.zip
Print diffs for failed tests
-rw-r--r--wscript10
1 files changed, 10 insertions, 0 deletions
diff --git a/wscript b/wscript
index 4adfe4aa..08aaec23 100644
--- a/wscript
+++ b/wscript
@@ -250,11 +250,21 @@ def earl_assertion(test, passed, asserter):
datetime.datetime.now().replace(microsecond=0).isoformat())
def check_output(out_filename, check_filename, subst_from='', subst_to=''):
+ import difflib
+ import sys
if not os.access(out_filename, os.F_OK):
Logs.pprint('RED', 'FAIL: output %s is missing' % out_filename)
elif not file_equals(check_filename, out_filename, subst_from, subst_to):
Logs.pprint('RED', 'FAIL: %s != %s' % (os.path.abspath(out_filename),
check_filename))
+ with open(out_filename) as out_file:
+ with open(check_filename) as check_file:
+ diff = difflib.unified_diff(check_file.readlines(),
+ out_file.readlines(),
+ fromfile=check_filename,
+ tofile=out_filename)
+ for line in diff:
+ sys.stderr.write(line)
else:
return True