diff mbox series

[v2,07/11] binman: Avoid use of expected failure

Message ID 20220813174051.1813081-8-sjg@chromium.org
State Accepted
Commit 73593e499cf33d22e04498d684a5aef29cea2a1e
Delegated to: Simon Glass
Headers show
Series binman: Enhancements to binman mkimage | expand

Commit Message

Simon Glass Aug. 13, 2022, 5:40 p.m. UTC
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>
---

(no changes since v1)

 tools/binman/ftest.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Simon Glass Aug. 21, 2022, 12:10 a.m. UTC | #1
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>
---

(no changes since v1)

 tools/binman/ftest.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 4f696c68600..ac54183c399 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -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__":