def mock_rename(src, dst): if '.bak' in dst: saved_backup['path'] = dst if os.path.exists(dst): _raise_file_exists(dst) else: real_rename(src, dst)
def mock_rename(src, dst): if os.path.exists(dst): _raise_file_exists(dst) elif '.bak' in dst: raise OSError("Failing rename to backup") else: real_rename(src, dst)
def mock_rename(src, dst): if '.bak' in dst: saved_backup['path'] = dst if os.path.exists(dst): _raise_file_exists(dst) elif 'path' in saved_backup and os.path.exists(saved_backup['path']) and src != saved_backup['path']: assert not os.path.exists(name2) assert os.path.exists(saved_backup['path']) raise OSError("Failed to copy after backup") else: real_rename(src, dst)