Re: [PATCH 4/5] kunit: tool: use `with open()` in unit test

2020-12-01 Thread Daniel Latypov
On Mon, Nov 30, 2020 at 11:33 PM David Gow wrote: > > On Tue, Dec 1, 2020 at 7:33 AM Daniel Latypov wrote: > > > > The use of manual open() and .close() calls seems to be an attempt to > > keep the contents in scope. > > But Python doesn't restrict variables like that, so we can introduce new > >

Re: [PATCH 4/5] kunit: tool: use `with open()` in unit test

2020-11-30 Thread David Gow
On Tue, Dec 1, 2020 at 7:33 AM Daniel Latypov wrote: > > The use of manual open() and .close() calls seems to be an attempt to > keep the contents in scope. > But Python doesn't restrict variables like that, so we can introduce new > variables inside of a `with` and use them outside. > > Do so to

[PATCH 4/5] kunit: tool: use `with open()` in unit test

2020-11-30 Thread Daniel Latypov
The use of manual open() and .close() calls seems to be an attempt to keep the contents in scope. But Python doesn't restrict variables like that, so we can introduce new variables inside of a `with` and use them outside. Do so to make the code more Pythonic. Signed-off-by: Daniel Latypov --- t