Fixes all SIM115 issues in gunittest, except for two where I couldn't find a way to address with enough confidence for use in our own testing (one is not resolvable with context managers, as the opened file descriptor is assigned to the class in one function, and expected to be closed by another call at the end of the execution).
Only in two functions I had to resort to indent the most of the function since there were usages of the file descriptor throughout the function, and was used inside and outside a loop.
Otherwise, I tried to keep the amount of lines needing an indentation to a minimum, by moving down the variables needing to be within the with closer to that construct (in other words, placing variables assignments out the with further up, that ends up being understood by git as no changes except deleting the existing opening of file/writing of file, and some new code underneath with a smaller with context manager).
Fixes all SIM115 issues in gunittest, except for two where I couldn't find a way to address with enough confidence for use in our own testing (one is not resolvable with context managers, as the opened file descriptor is assigned to the class in one function, and expected to be closed by another call at the end of the execution).
Only in two functions I had to resort to indent the most of the function since there were usages of the file descriptor throughout the function, and was used inside and outside a loop.
Otherwise, I tried to keep the amount of lines needing an indentation to a minimum, by moving down the variables needing to be within the
with
closer to that construct (in other words, placing variables assignments out thewith
further up, that ends up being understood by git as no changes except deleting the existing opening of file/writing of file, and some new code underneath with a smallerwith
context manager).Adresses ResourceWarnings like (CI on Windows):