本文整理汇总了Python中app.project_type.git.Git._execute_git_remote_command方法的典型用法代码示例。如果您正苦于以下问题:Python Git._execute_git_remote_command方法的具体用法?Python Git._execute_git_remote_command怎么用?Python Git._execute_git_remote_command使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.project_type.git.Git
的用法示例。
在下文中一共展示了Git._execute_git_remote_command方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_execute_git_remote_command_doesnt_auto_add_known_host_if_no_prompt
# 需要导入模块: from app.project_type.git import Git [as 别名]
# 或者: from app.project_type.git.Git import _execute_git_remote_command [as 别名]
def test_execute_git_remote_command_doesnt_auto_add_known_host_if_no_prompt(self):
def expect_side_effect(*args, **kwargs):
if args[0] == ['^User.*: ', '^Pass.*: ', '.*Are you sure you want to continue connecting.*']:
raise pexpect.TIMEOUT('some_msg')
return None
self.mock_pexpect_child.expect.side_effect = expect_side_effect
git = Git("some_remote_value", 'origin', 'ref/to/some/branch')
git._execute_git_remote_command('some_command')
self.assertEquals(self.mock_pexpect_child.sendline.call_count, 0)
示例2: test_execute_git_remote_command_auto_adds_known_host_if_prompted
# 需要导入模块: from app.project_type.git import Git [as 别名]
# 或者: from app.project_type.git.Git import _execute_git_remote_command [as 别名]
def test_execute_git_remote_command_auto_adds_known_host_if_prompted(self):
prompted = False
def expect_side_effect(*args, **kwargs):
nonlocal prompted
if args[0] == ['^User.*: ', '^Pass.*: ', '.*Are you sure you want to continue connecting.*'] \
and not prompted:
prompted = True
return 2
elif args[0] == pexpect.EOF:
return 0
raise pexpect.TIMEOUT('some_msg')
self.mock_pexpect_child.expect.side_effect = expect_side_effect
Configuration['git_strict_host_key_checking'] = False
git = Git("some_remote_value", 'origin', 'ref/to/some/branch')
git._execute_git_remote_command('some_command')
self.mock_pexpect_child.sendline.assert_called_with("yes")
示例3: test_setup_build_when_existing_repo_is_shallow_deletes_repo
# 需要导入模块: from app.project_type.git import Git [as 别名]
# 或者: from app.project_type.git.Git import _execute_git_remote_command [as 别名]
def test_setup_build_when_existing_repo_is_shallow_deletes_repo(self):
url = 'url'
repo_path = 'repo_path'
git = Git(url)
git._execute_and_raise_on_failure = Mock()
git._repo_directory = repo_path
git.execute_command_in_project = Mock(side_effect=[('', 0), ('', 0)])
self.patch('os.path.exists').return_value = True
self.patch('os.path.isfile').return_value = True
mock_fs = self.patch('app.project_type.git.fs')
mock_rmtree = self.patch('shutil.rmtree')
git._execute_git_remote_command = Mock()
mock_fs.create_dir.call_count = 0 # only measure calls made in _setup_build
mock_rmtree.call_count = 0
git._setup_build()
self.assertEqual(mock_fs.create_dir.call_count, 1)
self.assertEqual(mock_rmtree.call_count, 1)