[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFd5g45fP3OuRh-uWeLMYU+YBOFKGBKmzSbXKuWu9QstAD3mRw@mail.gmail.com>
Date: Tue, 14 Dec 2021 16:43:50 -0500
From: Brendan Higgins <brendanhiggins@...gle.com>
To: Daniel Latypov <dlatypov@...gle.com>, skhan@...uxfoundation.org
Cc: davidgow@...gle.com, linux-kernel@...r.kernel.org,
kunit-dev@...glegroups.com, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v2 1/2] kunit: tool: use dataclass instead of collections.namedtuple
On Tue, Dec 14, 2021 at 2:26 PM Daniel Latypov <dlatypov@...gle.com> wrote:
>
> namedtuple is a terse way of defining a collection of fields.
> However, it does not allow us to annotate the type of these fields.
> It also doesn't let us have any sort of inheritance between types.
>
> Since commit df4b0807ca1a ("kunit: tool: Assert the version
> requirement"), kunit.py has asserted that it's running on python >=3.7.
>
> So in that case use a 3.7 feature, dataclasses, to replace these.
>
> Changes in detail:
> * Make KunitExecRequest contain all the fields needed for exec_tests
> * Use inheritance to dedupe fields
> * also allows us to e.g. pass a KUnitRequest in as a KUnitParseRequest
> * this has changed around the order of some fields
> * Use named arguments when constructing all request objects in kunit.py
> * This is to prevent accidentally mixing up fields, etc.
>
> Signed-off-by: Daniel Latypov <dlatypov@...gle.com>
> Reviewed-by: Brendan Higgins <brendanhiggins@...gle.com>
Looks good. Thanks for the rebase!
Powered by blists - more mailing lists