@@ -73,20 +73,16 @@ def check(self, reference=None, expectedErrors=0):
7373
7474 if not reference :
7575 # The caller only wants to check the number of errors
76- return True
76+ return
7777
7878 # The generation has succeeded as expected - let's compare with the reference.
79- unified = difflib .unified_diff (reference ,
80- actual ,
81- fromfile = "reference.xml" ,
82- tofile = "-" ,
83- lineterm = "" )
84- diffs = list (unified )
85- if diffs :
86- for d in diffs :
87- print (d )
88- return AssertionError ("The result and the reference don't match." )
89- return True
79+ if reference != actual :
80+ unified = difflib .unified_diff (reference ,
81+ actual ,
82+ fromfile = "reference.xml" ,
83+ tofile = "-" ,
84+ lineterm = "" )
85+ raise AssertionError ("The result and the reference don't match:" + "\n " .join (unified ))
9086
9187
9288basedir = os .path .dirname (sys .argv [0 ])
@@ -106,14 +102,14 @@ class TestCase(unittest.TestCase):
106102
107103 def test_nominal (self ):
108104 tester = Tester (self .nominal_pfconfig , self .nominal_vector )
109- self . assertTrue ( tester .check (self .nominal_reference ) )
105+ tester .check (self .nominal_reference )
110106
111107 def test_nonfatalError (self ):
112108 vector = copy .copy (self .nominal_vector )
113109 vector .edds .append (os .path .join (vector_dir , "duplicate.pfw" ))
114110
115111 tester = Tester (self .nominal_pfconfig , vector )
116- self . assertTrue ( tester .check (self .nominal_reference , expectedErrors = 1 ) )
112+ tester .check (self .nominal_reference , expectedErrors = 1 )
117113
118114if __name__ == "__main__" :
119115 unittest .main ()
0 commit comments