From 0ed0405c5bd95595da2ebd62cc9847c177f58aea Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Thu, 1 Nov 2018 22:19:39 +0100 Subject: [PATCH] [tests] do not try re-opening temporary file on windows, display a warning --- python/tests/utils.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/python/tests/utils.py b/python/tests/utils.py index b374fe5f..ee73e005 100644 --- a/python/tests/utils.py +++ b/python/tests/utils.py @@ -35,13 +35,9 @@ def del_tmp_sink_path(path): try: os.unlink(path) except WindowsError as e: - print("deleting {:s} failed ({:s}), reopening".format(path, repr(e))) - with open(path, 'wb') as f: - f.close() - try: - os.unlink(path) - except WindowsError as f: - print("deleting {:s} failed ({:s}), aborting".format(path, repr(e))) + # removing the temporary directory sometimes fails on windows + errmsg = "failed deleting temporary file {:s} ({:s})" + warnings.warn(UserWarning(errmsg.format(path, repr(e)))) def array_from_yaml_file(filename): import yaml -- 2.11.0