From 2d9c2d5ecd6d28a8d07fcef3f9e6c68dcb6e4faf Mon Sep 17 00:00:00 2001 From: Michael Foord Date: Tue, 4 May 2010 22:29:10 +0000 Subject: Fix error handling removing files in test.support.unlink --- Lib/test/support.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/support.py b/Lib/test/support.py index 4ea6c05..08105df 100644 --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -186,7 +186,7 @@ def unlink(filename): os.unlink(filename) except OSError as error: # The filename need not exist. - if error.errno != errno.ENOENT: + if error.errno not in (errno.ENOENT, errno.ENOTDIR): raise def rmtree(path): @@ -376,6 +376,7 @@ else: # module name. TESTFN = "{}_{}_tmp".format(TESTFN, os.getpid()) + # Assuming sys.getfilesystemencoding()!=sys.getdefaultencoding() # TESTFN_UNICODE is a filename that can be encoded using the # file system encoding, but *not* with the default (ascii) encoding -- cgit v0.12