Changeset: 5c5c3249cb81 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5c5c3249cb81
Modified Files:
sql/test/prepare/Tests/round-or-truncate.Bug-6193.SQL.py
testing/sqltest.py
Branch: mtest
Log Message:
optionally ignores mapi msg headers when compare stable out
diffs (46 lines):
diff --git a/sql/test/prepare/Tests/round-or-truncate.Bug-6193.SQL.py
b/sql/test/prepare/Tests/round-or-truncate.Bug-6193.SQL.py
--- a/sql/test/prepare/Tests/round-or-truncate.Bug-6193.SQL.py
+++ b/sql/test/prepare/Tests/round-or-truncate.Bug-6193.SQL.py
@@ -6,6 +6,6 @@ with SQLTestCase() as tc:
with open('round-or-truncate.Bug-6193.sql') as f:
tc.execute(query=None, client='mclient', stdin=f)\
.assertSucceeded()\
- .assertMatchStableOut(fout='round-or-truncate.Bug-6193.stable.out')
+
.assertMatchStableOut(fout='round-or-truncate.Bug-6193.stable.out',
ignore_headers=True)
diff --git a/testing/sqltest.py b/testing/sqltest.py
--- a/testing/sqltest.py
+++ b/testing/sqltest.py
@@ -55,6 +55,15 @@ def filter_junk(s: str):
return False
return True
+def filter_headers(s: str):
+ """filters lines prefixed with % (MAPI headers)"""
+ s = s.strip()
+ if s.startswith('%'):
+ return False
+ if s == '':
+ return False
+ return True
+
def filter_matching_blocks(a: [str] = [], b: [str] = []):
# TODO add some ctx before any mismatch lines
ptr = 0
@@ -319,11 +328,14 @@ class MclientTestResult(TestCaseResult,
raise SystemExit(e)
return self
- def assertMatchStableOut(self, fout):
+ def assertMatchStableOut(self, fout, ignore_headers=False):
stable = []
data = list(filter(filter_junk, self.data.split('\n')))
with open(fout, 'r') as f:
stable = list(filter(filter_junk, f.read().split('\n')))
+ if ignore_headers:
+ 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:
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list