kunit: tool: drop last uses of collections.namedtuple
authorDaniel Latypov <dlatypov@google.com>
Tue, 18 Jan 2022 19:09:21 +0000 (11:09 -0800)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 4 Apr 2022 20:25:53 +0000 (14:25 -0600)
commite6f61920653925e6fa9aceb5cdb47ecf543986c8
treececb0e7e59bb67ed4c0d5ec93cc17836b50d0a38
parent89aa72cd3052b70ade40fa02a018f8f509355790
kunit: tool: drop last uses of collections.namedtuple

Since we formally require python3.7+ since commit df4b0807ca1a
("kunit: tool: Assert the version requirement"), we can just use
@dataclasses.dataclass instead.

In kunit_config.py, we used namedtuple to create a hashable type that
had `name` and `value` fields and had to subclass it to define a custom
`__str__()`.
@datalcass lets us just define one type instead.

In qemu_config.py, we use namedtuple to allow modules to define various
parameters. Using @dataclass, we can add type-annotations for all these
fields, making our code more typesafe and making it easier for users to
figure out how to define new configs.

Signed-off-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/kunit/kunit_config.py
tools/testing/kunit/qemu_config.py