示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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)
示例#4
0
 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)
示例#5
0
 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)
示例#6
0
 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)