def _rmtree_func(path, ignore_errors=True, onerror=None): directory = fs_encode(path) global _rmtree shutil_rmtree = _rmtree if onerror is None: onerror = handle_remove_readonly try: shutil_rmtree(directory, ignore_errors=ignore_errors, onerror=onerror) except (IOError, OSError, FileNotFoundError, PermissionError) as exc: # Ignore removal failures where the file doesn't exist if exc.errno != errno.ENOENT: raise
def test_fs_encode(): # This fails in the normal backports library: # see https://github.com/PiDelport/backports.os/issues/13 assert fs_decode(fs_encode(u"unicode\u0141")) == u"unicode\u0141"