Skip to contentSkip to conversation

oeqa/loader: Ensure module names don't contain uppercase characters

PATCH In review Richard Purdie 2 participants 4 messages Mar 30, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 oeqa/loader: Ensure module names don't contain uppercase characters

Python modules aren't supposed to have uppercase characters in their names according to python conventions. We have regexs in the code which work on that assumption too. Rather than showing errors under some filtering situations, make it clear and error if a problematic name is seen.

---
 meta/lib/oeqa/core/loader.py | 3 +++
 1 file changed, 3 insertions(+)
meta/lib/oeqa/core/loader.py +3 -0
index f25b5970e93..d12d5a055cc 100644
@@ -316,6 +316,9 @@ class OETestLoader(unittest.TestLoader):
                                   module_name_small in self.modules) \
                                else False
 
+        if any(c.isupper() for c in module.__name__):
+            raise SystemExit("Module '%s' contains uppercase characters and this isn't supported. Please fix the module name." % module.__name__)
+
         return (load_module, load_underscore)
 
 
Signature · 1 line
2.39.2
Acked-by on v1 1/1
#1 lore raw

I've similar one locally, but this one works for me as well.

Quoted 40 lines · Richard Purdie

Python modules aren't supposed to have uppercase characters in their names according to python conventions. We have regexs in the code which work on that assumption too. Rather than showing errors under some filtering situations, make it clear and error if a problematic name is seen.

---
 meta/lib/oeqa/core/loader.py | 3 +++
 1 file changed, 3 insertions(+)
meta/lib/oeqa/core/loader.py +3 -1
index f25b5970e93..d12d5a055cc 100644
@@ -316,6 +316,9 @@ class OETestLoader(unittest.TestLoader):
                                   module_name_small in self.modules) \
                                else False
 
+        if any(c.isupper() for c in module.__name__):
+            raise SystemExit("Module '%s' contains uppercase characters
 and this isn't supported. Please fix the module name." % module.__name__)
+
         return (load_module, load_underscore)
 
 
--

2.39.2

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

#2 lore raw
Quoted 3 lines · Martin Jansa

I've similar one locally, but this one works for me as well.

I did check your public branches and didn't see it and wanted to get the other patch in so I quickly put it together!

Cheers,

Richard

#3 lore raw
Quoted 8 lines · Richard Purdie
Quoted 3 lines · Martin Jansa

I've similar one locally, but this one works for me as well.

I did check your public branches and didn't see it and wanted to get the other patch in so I quickly put it together!

Yeah, I was hiding it in my poky branches I'm using for selftest testing, sorry. I was going to send it after resolving eSDK failure when uninative is not enabled (which is taking too long, because I got stuck in something else again :/).

I've sent at least the pending runqemu changes and small fix for imagefeatures.py change merged today.

Cheers,

Quoted 4 lines

Cheers,

Richard