Assertions in test_readme does not provide context message when they
fail. Which leads to errors like:

  File 
"/media/workspace/yocto_master/openembedded-core/scripts/lib/checklayer/cases/common.py",
 line 41, in test_readme
    self.assertTrue(email_regex.match(data))
    AssertionError: None is not true

This patch adds context messages to the assertions to help identify the
issue when they fail.

Signed-off-by: Ricardo Ungerer <[email protected]>
---
 scripts/lib/checklayer/cases/common.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/lib/checklayer/cases/common.py 
b/scripts/lib/checklayer/cases/common.py
index ddead69a7b..0114481434 100644
--- a/scripts/lib/checklayer/cases/common.py
+++ b/scripts/lib/checklayer/cases/common.py
@@ -32,13 +32,14 @@ class CommonCheckLayer(OECheckLayerTestCase):
 
         # If a layer's README references another README, then the checks below 
are not valid
         if re.search('README', data, re.IGNORECASE):
+            print("Layer README references another README; skipping further 
README checks.")
             return
 
-        self.assertIn('maintainer', data.lower())
-        self.assertIn('patch', data.lower())
+        self.assertIn('maintainer', data.lower(), msg="No maintainer info 
found in README.")
+        self.assertIn('patch', data.lower(), msg="No patching information 
found in README.")
         # Check that there is an email address in the README
         email_regex = re.compile(r"[^@]+@[^@]+")
-        self.assertTrue(email_regex.match(data))
+        self.assertTrue(email_regex.match(data), msg="No email address found 
in README.")
 
     def find_file_by_name(self, globs):
         """
-- 
2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#229789): 
https://lists.openembedded.org/g/openembedded-core/message/229789
Mute This Topic: https://lists.openembedded.org/mt/117369505/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to