Fix error handling removing files in test.support.unlink

This commit is contained in:
Michael Foord 2010-05-04 22:29:10 +00:00
parent 667ce06de4
commit 2d9c2d5ecd

View file

@ -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