lkml.org 
[lkml]   [2021]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] kunit: tool: misc fixes (unused vars, imports, leaked files)
On Wed, Sep 29, 2021 at 6:11 AM Daniel Latypov <dlatypov@google.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@google.com>
> ---

These all seem sensible to me. Thanks for cleaning this up!

Reviewed-by: David Gow <davidgow@google.com>

-- David

\
 
 \ /
  Last update: 2021-09-29 02:35    [W:1.885 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site