Skip to contentSkip to conversation

qemu-iotests/iotests.py: improve assert_qmp message

PATCH In review Vladimir Sementsov-Ogievskiy 3 participants 4 messages Oct 26, 2019 – Oct 28, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu-iotests/iotests.py: improve assert_qmp message

Make it obvious, from the two values which is found at path and which is expected.

---

It's a pain, I can never remember it, and checking each time in source code who is who is boring.

 tests/qemu-iotests/iotests.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/qemu-iotests/iotests.py +2 -2
index 709def4d5d..e805b9ab14 100644
@@ -729,8 +729,8 @@ class QMPTestCase(unittest.TestCase):
             self.fail('no match for "%s" in %s' % (str(result), str(value)))
         else:
             self.assertEqual(result, value,
-                             'values not equal "%s" and "%s"'
-                                 % (str(result), str(value)))
+                             '"%s" is "%s", expected "%s"'
+                                 % (path, str(result), str(value)))
 
     def assert_no_active_block_jobs(self):
         result = self.vm.qmp('query-block-jobs')
Signature · 1 line
2.21.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Vladimir Sementsov-Ogievskiy

Make it obvious, from the two values which is found at path and which is expected.

Maybe:

"From the two values compared, make it obvious which is found at path, and which is expected."

Quoted 26 lines

---

It's a pain, I can never remember it, and checking each time in source code who is who is boring.

  tests/qemu-iotests/iotests.py | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
tests/qemu-iotests/iotests.py +2 -2
index 709def4d5d..e805b9ab14 100644
@@ -729,8 +729,8 @@ class QMPTestCase(unittest.TestCase):
              self.fail('no match for "%s" in %s' % (str(result), str(value)))
          else:
              self.assertEqual(result, value,
-                             'values not equal "%s" and "%s"'
-                                 % (str(result), str(value)))
+                             '"%s" is "%s", expected "%s"'
+                                 % (path, str(result), str(value)))
 
      def assert_no_active_block_jobs(self):
          result = self.vm.qmp('query-block-jobs')
#2 lore raw
Quoted 9 lines · Philippe Mathieu-Daudé
Quoted 2 lines · Vladimir Sementsov-Ogievskiy

Make it obvious, from the two values which is found at path and which is expected.

Maybe:

"From the two values compared, make it obvious which is found at path, and which is expected."

Thanks for review and better wording!

Quoted 26 lines
Quoted 26 lines

---

It's a pain, I can never remember it, and checking each time in source code who is who is boring.

  tests/qemu-iotests/iotests.py | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
tests/qemu-iotests/iotests.py +0 -0
index 709def4d5d..e805b9ab14 100644
@@ -729,8 +729,8 @@ class QMPTestCase(unittest.TestCase):
               self.fail('no match for "%s" in %s' % (str(result), str(value)))

          else:
              self.assertEqual(result, value,
-                             'values not equal "%s" and "%s"' -                                 % (str(result), str(value))) +                             '"%s" is "%s", expected "%s"' +                                 % (path, str(result), str(value))) def assert_no_active_block_jobs(self):
          result = self.vm.qmp('query-block-jobs')

Signature · 2 lines
Best regards,
Vladimir
#3 lore raw

Am 26.10.2019 um 18:58 hat Vladimir Sementsov-Ogievskiy geschrieben:

Quoted 5 lines
Quoted 4 lines · Philippe Mathieu-Daudé
Quoted 2 lines · Vladimir Sementsov-Ogievskiy

Make it obvious, from the two values which is found at path and which is expected.

Quoted 7 lines
Quoted 5 lines

Maybe:

"From the two values compared, make it obvious which is found at path, and which is expected."

Thanks for review and better wording!

Thanks, updated the commit message and applies to the block branch.

Kevin