当前位置: 首页>>代码示例>>Python>>正文


Python Git.fetch_project方法代码示例

本文整理汇总了Python中app.project_type.git.Git.fetch_project方法的典型用法代码示例。如果您正苦于以下问题:Python Git.fetch_project方法的具体用法?Python Git.fetch_project怎么用?Python Git.fetch_project使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app.project_type.git.Git的用法示例。


在下文中一共展示了Git.fetch_project方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_slave_param_overrides_returns_expected

# 需要导入模块: from app.project_type.git import Git [as 别名]
# 或者: from app.project_type.git.Git import fetch_project [as 别名]
    def test_slave_param_overrides_returns_expected(self):
        self._patch_popen({
            'git rev-parse FETCH_HEAD': _FakePopenResult(stdout='deadbee123\n')
        })
        Configuration['repo_directory'] = '/repo-directory'

        git = Git(url='http://original-user-specified-url.test/repo-path/repo-name')
        git.fetch_project()
        actual_overrides = git.slave_param_overrides()

        expected_overrides = {
            'url': 'ssh://fake_hostname/repodirectory/originaluserspecifiedurl.test/repopath/reponame',
            'branch': 'refs/clusterrunner/deadbee123',
        }
        self.assertEqual(expected_overrides, actual_overrides, 'Slave param overrides from Git object should match'
                                                               'expected.')
开发者ID:linearregression,项目名称:ClusterRunner,代码行数:18,代码来源:test_git.py

示例2: test_fetch_project_passes_depth_parameter_for_shallow_clone_configuration

# 需要导入模块: from app.project_type.git import Git [as 别名]
# 或者: from app.project_type.git.Git import fetch_project [as 别名]
    def test_fetch_project_passes_depth_parameter_for_shallow_clone_configuration(self, shallow_clone):
        Configuration['shallow_clones'] = shallow_clone
        self.os_path_isfile_mock.return_value = False
        self.os_path_exists_mock.return_value = False
        mock_popen = self._patch_popen({'git rev-parse$': _FakePopenResult(return_code=1)})

        git = Git(url='http://original-user-specified-url.test/repo-path/repo-name')
        git.fetch_project()

        git_clone_call = call(AnyStringMatching('git clone --depth=1'), start_new_session=ANY,
                              stdout=ANY, stderr=ANY, cwd=ANY, shell=ANY)
        if shallow_clone:
            self.assertIn(git_clone_call, mock_popen.call_args_list, 'If shallow cloning, the --depth=1 parameter '
                                                                     'should be present.')
        else:
            self.assertNotIn(git_clone_call, mock_popen.call_args_list, 'If deep cloning, the --depth=1 parameter '
                                                                        'must be absent.')
开发者ID:Medium,项目名称:ClusterRunner,代码行数:19,代码来源:test_git.py

示例3: test_repo_is_cloned_if_and_only_if_rev_parse_fails

# 需要导入模块: from app.project_type.git import Git [as 别名]
# 或者: from app.project_type.git.Git import fetch_project [as 别名]
    def test_repo_is_cloned_if_and_only_if_rev_parse_fails(self, rev_parse_return_code, expect_git_clone_call):
        mock_popen = self._patch_popen({
            'git rev-parse$': _FakePopenResult(return_code=rev_parse_return_code)
        })
        Configuration['repo_directory'] = '/repo-directory'

        git = Git(url='http://original-user-specified-url.test/repo-path/repo-name')
        git.fetch_project()

        git_clone_call = call(AnyStringMatching('git clone'), start_new_session=ANY,
                              stdout=ANY, stderr=ANY, cwd=ANY, shell=ANY)
        if expect_git_clone_call:
            self.assertIn(git_clone_call, mock_popen.call_args_list, 'If "git rev-parse" returns a failing exit code, '
                                                                     '"git clone" should be called.')
        else:
            self.assertNotIn(git_clone_call, mock_popen.call_args_list, 'If "git rev-parse" returns a successful exit '
                                                                        'code, "git clone" should not be called.')
开发者ID:Medium,项目名称:ClusterRunner,代码行数:19,代码来源:test_git.py


注:本文中的app.project_type.git.Git.fetch_project方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。