Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)