CIL
CIL copied to clipboard
ResourceWarning in unit tests (win)
C:\Users\gemst\miniconda3\conda-bld\cil_1708540316940\test_tmp\Wrappers\Python\test\utils.py:130: ResourceWarning: unclosed file <_io.TextIOWrapper name='nul' mode='w' encoding='cp1252'>
sys.stdout = sys.__stdout__
ResourceWarning: Enable tracemalloc to get the object allocation traceback
https://github.com/TomographicImaging/CIL/blob/7632209f0ed756ce4258782af4c2c531b34c1501/Wrappers/Python/test/utils.py#L125-L130
I guess we should close os.devnull
if it exists.
def disable_print():
sys.stdout = open(os.devnull, 'w')
def enable_print():
if sys.stdout is not sys.__stdout__:
sys.stdout.close()
sys.stdout = sys.__stdout__