def test_file_exists(self, lexists_mock): self.assertTrue(utils.file_exists('file1')) self.assertFalse(utils.file_exists('file2')) self.assertEqual( lexists_mock.call_args_list, [mock.call('file1'), mock.call('file2')])
def check_file(self, file_path): """Checks if file exists :param str file_path: path to the file :raises: error.ArgumentException if file does not exist """ if not utils.file_exists(file_path): raise error.ArgumentException( 'File "{0}" does not exists'.format(file_path))
def config_file(file_path): if not utils.file_exists(file_path): raise argparse.ArgumentTypeError( 'File "{0}" does not exist'.format(file_path)) return file_path
def check_file(self, file_path): if not utils.file_exists(file_path): raise error.ArgumentException( 'File {0} does not exists'.format(file_path) )