kunit: tool: Fix a python tuple typing error
PATCH 1/1 kunit: tool: Fix a python tuple typing error
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")
--- tools/testing/kunit/kunit_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/kunit/kunit_config.py +1 -1
@@ -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):
Signature · 1 line
2.30.0.617.g56c4b15f3c-goog
Quoted 5 lines · David Gow' via KUnit Development
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.
Quoted 3 lines
Fixes
97752c39bd("kunit:kunit_tool: Allow .kunitconfig to disable config items")Signed-off-by David Gow <[email protected]>
Quoted 24 lines
--- tools/testing/kunit/kunit_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/kunit/kunit_config.py +1
-2@@ -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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/kunit-dev/20210223054930.2345555-1-davidgow%40google.com.
Quoted 8 lines · David Gow' via KUnit Development
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 <[email protected]>