diff mbox series

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

Message ID 20230330224404.51167-1-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit 7964a6ee54e881a6128707a7f2a42eec2ed63881
Headers show
Series oeqa/loader: Ensure module names don't contain uppercase characters | expand

Commit Message

Richard Purdie March 30, 2023, 10:44 p.m. UTC
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.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/lib/oeqa/core/loader.py | 3 +++
 1 file changed, 3 insertions(+)

Comments

Martin Jansa March 30, 2023, 11:16 p.m. UTC | #1
I've similar one locally, but this one works for me as well.

Acked-by: Martin Jansa <Martin.Jansa@gmail.com>

On Fri, Mar 31, 2023 at 12:44 AM Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> 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.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>  meta/lib/oeqa/core/loader.py | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/meta/lib/oeqa/core/loader.py b/meta/lib/oeqa/core/loader.py
> index f25b5970e93..d12d5a055cc 100644
> --- a/meta/lib/oeqa/core/loader.py
> +++ b/meta/lib/oeqa/core/loader.py
> @@ -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: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> Martin.Jansa@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Richard Purdie March 30, 2023, 11:28 p.m. UTC | #2
On Fri, 2023-03-31 at 01:16 +0200, Martin Jansa wrote:
> I've similar one locally, but this one works for me as well.
> 
> Acked-by: Martin Jansa <Martin.Jansa@gmail.com>

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
Martin Jansa March 30, 2023, 11:44 p.m. UTC | #3
On Fri, Mar 31, 2023 at 1:28 AM Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> On Fri, 2023-03-31 at 01:16 +0200, Martin Jansa wrote:
> > I've similar one locally, but this one works for me as well.
> >
> > Acked-by: Martin Jansa <Martin.Jansa@gmail.com>
>
> 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,


> Cheers,
>
> Richard
>
diff mbox series

Patch

diff --git a/meta/lib/oeqa/core/loader.py b/meta/lib/oeqa/core/loader.py
index f25b5970e93..d12d5a055cc 100644
--- a/meta/lib/oeqa/core/loader.py
+++ b/meta/lib/oeqa/core/loader.py
@@ -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)