binman: Avoid use of expected failure
authorSimon Glass <sjg@chromium.org>
Sat, 13 Aug 2022 17:40:46 +0000 (11:40 -0600)
committerSimon Glass <sjg@chromium.org>
Sun, 21 Aug 2022 00:07:32 +0000 (18:07 -0600)
The testReplaceSectionSimple() test is the only one which expects failure.
It looks odd in the output and takes time to glance at it to see that all
is in fact well. Also it does not check that the right exception is
generated.

Use the more common (in binman) approach of checking for an exception.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/binman/ftest.py

index 4f696c6..ac54183 100644 (file)
@@ -5712,14 +5712,15 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
         self.assertIsNotNone(path)
         self.assertEqual(expected_fdtmap, fdtmap)
 
-    @unittest.expectedFailure
     def testReplaceSectionSimple(self):
         """Test replacing a simple section with arbitrary data"""
         new_data = b'w' * len(COMPRESS_DATA + U_BOOT_DATA)
-        data, expected_fdtmap, _ = self._RunReplaceCmd(
-            'section', new_data,
-            dts='234_replace_section_simple.dts')
-        self.assertEqual(new_data, data)
+        with self.assertRaises(ValueError) as exc:
+            self._RunReplaceCmd('section', new_data,
+                                dts='234_replace_section_simple.dts')
+        self.assertIn(
+            "Node '/section': Replacing sections is not implemented yet",
+            str(exc.exception))
 
 
 if __name__ == "__main__":