diff --git a/nbval/plugin.py b/nbval/plugin.py index 34dcce5..7ec5247 100644 --- a/nbval/plugin.py +++ b/nbval/plugin.py @@ -481,12 +481,18 @@ def compare_outputs(self, test, ref, skip_compare=None): ) return False elif test_keys - ref_keys: + extra_keys = test_keys - ref_keys self.comparison_traceback.append( cc.FAIL - + "Unexpected output fields from running code: %s" - % (test_keys - ref_keys) + + "Unexpected output fields from running code: %s" % extra_keys + cc.ENDC - ) + + "<<<<<<<<<<<< Unexpected content:" + + "\n".join("%s: %s" % (i, testing_outs[i]) for i in extra_keys) + + cc.FAIL + + '>>>>>>>>>>>>' + + cc.ENDC + ) + print('IN STDERR WE GOT: %s' % testing_outs['stderr']) return False # If we've got to here, the two dicts must have the same set of keys