From ca66060d7dd4bd4e11d2f64714de976cb1849b2d Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 4 May 2017 16:59:42 +0200 Subject: [PATCH] bpo-30265: support.unlink() don't catch any OSError support.unlink() now only ignores ENOENT and ENOTDIR, instead of ignoring any OSError exception. --- Lib/test/support/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index ef0ced6fae4e57..7f3ad5c972918c 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -276,8 +276,9 @@ def _rmtree_inner(path): def unlink(filename): try: _unlink(filename) - except OSError: - pass + except OSError as exc: + if exc.errno not in (errno.ENOENT, errno.ENOTDIR): + raise def rmdir(dirname): try: