summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristian Franke <chris@opensourcerouting.org>2017-03-28 18:23:47 +0200
committerChristian Franke <chris@opensourcerouting.org>2017-03-28 18:56:38 +0200
commit1ea8289e2abd1a020310d6cab8dfc05cdd195d5c (patch)
tree78d6a70deca56431c349dc82072d79aa3cf595cb /tests
parentc1ec5aaf7c17357ea21835bab4d41bff28506fd8 (diff)
tests: format TestRefMismatch more readable
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/helpers/python/frrtest.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/helpers/python/frrtest.py b/tests/helpers/python/frrtest.py
index 20c854f66c..21944bcf98 100644
--- a/tests/helpers/python/frrtest.py
+++ b/tests/helpers/python/frrtest.py
@@ -27,6 +27,7 @@ import sys
import re
import inspect
import os
+import difflib
import frrsix
@@ -154,7 +155,18 @@ class TestMultiOut(_TestMultiOut):
#
class TestRefMismatch(Exception):
- pass
+ def __init__(self, _test, outtext, reftext):
+ self.outtext = outtext.decode('utf8') if type(outtext) is bytes else outtext
+ self.reftext = reftext.decode('utf8') if type(reftext) is bytes else reftext
+
+ def __str__(self):
+ rv = 'Expected output and actual output differ:\n'
+ rv += '\n'.join(difflib.unified_diff(self.reftext.splitlines(),
+ self.outtext.splitlines(),
+ 'outtext', 'reftext',
+ lineterm=''))
+ return rv
+
class TestExitNonzero(Exception):
pass