summaryrefslogtreecommitdiff
path: root/tests/helpers/python/frrtest.py
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-03-30 06:14:21 -0500
committerGitHub <noreply@github.com>2017-03-30 06:14:21 -0500
commitfdbfd655c186fbba98ea4dca4ff5b89fd6b06d09 (patch)
tree264302935857d92a296da69c637357d98071af98 /tests/helpers/python/frrtest.py
parentaba41ec40c713cfdf6c8fd9725ae0bbe322dda47 (diff)
parent1ea8289e2abd1a020310d6cab8dfc05cdd195d5c (diff)
Merge pull request #299 from opensourcerouting/test-ref-out
tests: format TestRefMismatch more readable
Diffstat (limited to 'tests/helpers/python/frrtest.py')
-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