[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABVgOS=0K78N+KMK3km5TKVDD9L8AMRpNCfvihCqU2h3U-oE-w@mail.gmail.com>
Date: Wed, 29 Sep 2021 08:33:47 +0800
From: David Gow <davidgow@...gle.com>
To: Daniel Latypov <dlatypov@...gle.com>
Cc: Brendan Higgins <brendanhiggins@...gle.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
KUnit Development <kunit-dev@...glegroups.com>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>,
Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH] kunit: tool: misc fixes (unused vars, imports, leaked files)
On Wed, Sep 29, 2021 at 6:11 AM Daniel Latypov <dlatypov@...gle.com> wrote:
>
> Drop some variables in unit tests that were unused and/or add assertions
> based on them.
>
> For ExitStack, it was imported, but the `es` variable wasn't used so it
> didn't do anything, and we were leaking the file objects.
> Refactor it to just use nested `with` statements to properly close them.
>
> And drop the direct use of .close() on file objects in the kunit tool
> unit test, as these can be leaked if test assertions fail.
To clarify for a python novice: this is referring to using "with" so
that the file isn't leaked if the assertion fails, rather than
suggesting that leaks are okay for failing tests, right?
> Signed-off-by: Daniel Latypov <dlatypov@...gle.com>
> ---
These all seem sensible to me. Thanks for cleaning this up!
Reviewed-by: David Gow <davidgow@...gle.com>
-- David
Powered by blists - more mailing lists