]> granicus.if.org Git - python/commitdiff
Fix error handling removing files in test.support.unlink
authorMichael Foord <fuzzyman@voidspace.org.uk>
Tue, 4 May 2010 22:29:10 +0000 (22:29 +0000)
committerMichael Foord <fuzzyman@voidspace.org.uk>
Tue, 4 May 2010 22:29:10 +0000 (22:29 +0000)
Lib/test/support.py

index 4ea6c055a7fceb9401021120ce9e624da8baabf9..08105df4262d7e5834b3670889c38a36db5d41e1 100644 (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