Commit 1f7c3747 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

python: More fixes for GraphViz variations

One of our ArchLinux build produice slightly different SVG.

* wrap/python/tests/ipnbdoctest.py: Strip larger parts of SVG outputs.
parent 3c38780d
......@@ -70,10 +70,13 @@ def sanitize(s):
# SVG generated by graphviz may put note at different positions
# depending on the graphviz build. Let's just strip anything that
# look like a position.
s = re.sub(r'<path d="[^"]*"', '<path', s)
s = re.sub(r'x="[0-9.]+"', 'x=""', s)
s = re.sub(r'y="[0-9.]+"', 'y=""', s)
s = re.sub(r'<path[^/]* d="[^"]*"', '<path', s)
s = re.sub(r'points="[^"]*"', 'points=""', s)
s = re.sub(r'x="[0-9.-]+"', 'x=""', s)
s = re.sub(r'y="[0-9.-]+"', 'y=""', s)
s = re.sub(r'width="[0-9.]+pt"', 'width=""', s)
s = re.sub(r'height="[0-9.]+pt"', 'height=""', s)
s = re.sub(r'viewBox="[0-9 .-]*"', 'viewbox=""', s)
return s
......@@ -102,17 +105,18 @@ def compare_outputs(test, ref, skip_cmp=('png', 'traceback',
if key not in test:
print("missing key: %s != %s" % (test.keys(), ref.keys()))
return False
elif key not in skip_cmp and sanitize(test[key]) != sanitize(ref[key]):
print("mismatch %s:" % key)
exp = ref[key]
eff = test[key]
if exp[:-1] != '\n':
exp += '\n'
if eff[:-1] != '\n':
eff += '\n'
print(''.join(diff(exp.splitlines(1), eff.splitlines(1),
fromfile='expected', tofile='effective')))
return False
elif key not in skip_cmp:
exp = sanitize(ref[key])
eff = sanitize(test[key])
if exp != eff:
print("mismatch %s:" % key)
if exp[:-1] != '\n':
exp += '\n'
if eff[:-1] != '\n':
eff += '\n'
print(''.join(diff(exp.splitlines(1), eff.splitlines(1),
fromfile='expected', tofile='effective')))
return False
return True
def _wait_for_ready_backport(kc):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment