Changeset: 56051bfed85d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=56051bfed85d
Modified Files:
        testing/sqltest.py
Branch: default
Log Message:

assertMatchStableOut deals very badly with added/delete line in output.
Instead, if there are lines with significant differences (quick_ratio
< 0.95), provide a unified diff of the complete output.


diffs (30 lines):

diff --git a/testing/sqltest.py b/testing/sqltest.py
--- a/testing/sqltest.py
+++ b/testing/sqltest.py
@@ -394,13 +394,14 @@ class MclientTestResult(TestCaseResult, 
             stable = list(filter(filter_headers, stable))
             data = list(filter(filter_headers, data))
         a, b = filter_matching_blocks(stable, data)
-        diff = list(difflib.unified_diff(a, b, fromfile='stable', 
tofile='test'))
-        if len(diff) > 0:
-            err_file = self.test_case.err_file
-            msg = "expected to match stable output {} but it 
didnt\'t\n".format(fout)
-            msg+='\n'.join(diff)
-            self.assertion_errors.append(AssertionError(msg))
-            self.fail(msg)
+        if a or b:
+            diff = list(difflib.unified_diff(stable, data, fromfile='stable', 
tofile='test'))
+            if len(diff) > 0:
+                err_file = self.test_case.err_file
+                msg = "expected to match stable output {} but it 
didnt\'t\n".format(fout)
+                msg+='\n'.join(diff)
+                self.assertion_errors.append(AssertionError(msg))
+                self.fail(msg)
         return self
 
     def assertMatchStableError(self, ferr, ignore_err_messages=False):
@@ -675,4 +676,3 @@ class SQLTestCase():
 
         except (pymonetdb.Error, ValueError) as e:
             pass
-
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to