mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 20:51:17 +00:00
tests: format TestRefMismatch more readable
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
This commit is contained in:
parent
c1ec5aaf7c
commit
1ea8289e2a
@ -27,6 +27,7 @@ import sys
|
|||||||
import re
|
import re
|
||||||
import inspect
|
import inspect
|
||||||
import os
|
import os
|
||||||
|
import difflib
|
||||||
|
|
||||||
import frrsix
|
import frrsix
|
||||||
|
|
||||||
@ -154,7 +155,18 @@ class TestMultiOut(_TestMultiOut):
|
|||||||
#
|
#
|
||||||
|
|
||||||
class TestRefMismatch(Exception):
|
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):
|
class TestExitNonzero(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user