linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kunit: tool: Fix a python tuple typing error
@ 2021-02-23  5:49 David Gow
  2021-02-23  6:29 ` Daniel Latypov
  2021-02-26 21:15 ` Brendan Higgins
  0 siblings, 2 replies; 3+ messages in thread
From: David Gow @ 2021-02-23  5:49 UTC (permalink / raw)
  To: Daniel Latypov, Brendan Higgins, Shuah Khan
  Cc: David Gow, KUnit Development, linux-kselftest, Linux Kernel Mailing List

The first argument to namedtuple() should match the name of the type,
which wasn't the case for KconfigEntryBase.

Fixing this is enough to make mypy show no python typing errors again.

Fixes 97752c39bd ("kunit: kunit_tool: Allow .kunitconfig to disable config items")
Signed-off-by: David Gow <davidgow@google.com>
---
 tools/testing/kunit/kunit_config.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/kunit/kunit_config.py b/tools/testing/kunit/kunit_config.py
index 0b550cbd667d..1e2683dcc0e7 100644
--- a/tools/testing/kunit/kunit_config.py
+++ b/tools/testing/kunit/kunit_config.py
@@ -13,7 +13,7 @@ from typing import List, Set
 CONFIG_IS_NOT_SET_PATTERN = r'^# CONFIG_(\w+) is not set$'
 CONFIG_PATTERN = r'^CONFIG_(\w+)=(\S+|".*")$'
 
-KconfigEntryBase = collections.namedtuple('KconfigEntry', ['name', 'value'])
+KconfigEntryBase = collections.namedtuple('KconfigEntryBase', ['name', 'value'])
 
 class KconfigEntry(KconfigEntryBase):
 
-- 
2.30.0.617.g56c4b15f3c-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kunit: tool: Fix a python tuple typing error
  2021-02-23  5:49 [PATCH] kunit: tool: Fix a python tuple typing error David Gow
@ 2021-02-23  6:29 ` Daniel Latypov
  2021-02-26 21:15 ` Brendan Higgins
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Latypov @ 2021-02-23  6:29 UTC (permalink / raw)
  To: David Gow
  Cc: Brendan Higgins, Shuah Khan, KUnit Development,
	open list:KERNEL SELFTEST FRAMEWORK, Linux Kernel Mailing List

On Mon, Feb 22, 2021 at 9:49 PM 'David Gow' via KUnit Development
<kunit-dev@googlegroups.com> wrote:
>
> The first argument to namedtuple() should match the name of the type,
> which wasn't the case for KconfigEntryBase.
>
> Fixing this is enough to make mypy show no python typing errors again.

Ah, this is something apparently only newer versions of mypy detect.
On 0.782 I didn't see it, but after pip install --upgrade to 0.812, I
see the error.

While I'm here, I also upgraded my pytype install and checked.
It's happy w/ or w/o this patch.

So while this is in some sense an error only mypy cares about, this
fix does make the code more stylistically correct and should
definitely go in.

>
> Fixes 97752c39bd ("kunit: kunit_tool: Allow .kunitconfig to disable config items")
> Signed-off-by: David Gow <davidgow@google.com>

Reviewed-by: Daniel Latypov <dlatypov@google.com>

> ---
>  tools/testing/kunit/kunit_config.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/kunit/kunit_config.py b/tools/testing/kunit/kunit_config.py
> index 0b550cbd667d..1e2683dcc0e7 100644
> --- a/tools/testing/kunit/kunit_config.py
> +++ b/tools/testing/kunit/kunit_config.py
> @@ -13,7 +13,7 @@ from typing import List, Set
>  CONFIG_IS_NOT_SET_PATTERN = r'^# CONFIG_(\w+) is not set$'
>  CONFIG_PATTERN = r'^CONFIG_(\w+)=(\S+|".*")$'
>
> -KconfigEntryBase = collections.namedtuple('KconfigEntry', ['name', 'value'])
> +KconfigEntryBase = collections.namedtuple('KconfigEntryBase', ['name', 'value'])
>
>  class KconfigEntry(KconfigEntryBase):
>
> --
> 2.30.0.617.g56c4b15f3c-goog
>
> --
> You received this message because you are subscribed to the Google Groups "KUnit Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kunit-dev+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/kunit-dev/20210223054930.2345555-1-davidgow%40google.com.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kunit: tool: Fix a python tuple typing error
  2021-02-23  5:49 [PATCH] kunit: tool: Fix a python tuple typing error David Gow
  2021-02-23  6:29 ` Daniel Latypov
@ 2021-02-26 21:15 ` Brendan Higgins
  1 sibling, 0 replies; 3+ messages in thread
From: Brendan Higgins @ 2021-02-26 21:15 UTC (permalink / raw)
  To: David Gow
  Cc: Daniel Latypov, Shuah Khan, KUnit Development,
	open list:KERNEL SELFTEST FRAMEWORK, Linux Kernel Mailing List

On Mon, Feb 22, 2021 at 9:49 PM 'David Gow' via KUnit Development
<kunit-dev@googlegroups.com> wrote:
>
> The first argument to namedtuple() should match the name of the type,
> which wasn't the case for KconfigEntryBase.
>
> Fixing this is enough to make mypy show no python typing errors again.
>
> Fixes 97752c39bd ("kunit: kunit_tool: Allow .kunitconfig to disable config items")
> Signed-off-by: David Gow <davidgow@google.com>

Acked-by: Brendan Higgins <brendanhiggins@google.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-26 21:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-23  5:49 [PATCH] kunit: tool: Fix a python tuple typing error David Gow
2021-02-23  6:29 ` Daniel Latypov
2021-02-26 21:15 ` Brendan Higgins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).