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: