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


Python Git.execute_command_in_project方法代码示例

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


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

示例1: test_execute_command_in_project_type_specifies_cwd_if_doesnt_exist

# 需要导入模块: from app.project_type.git import Git [as 别名]
# 或者: from app.project_type.git.Git import execute_command_in_project [as 别名]
    def test_execute_command_in_project_type_specifies_cwd_if_doesnt_exist(self):
        project_type_popen_patch = self._patch_popen()

        git_env = Git("ssh://scm.dev.box.net/box/www/current", 'origin', 'refs/changes/78/151978/27')
        git_env.project_directory = 'proj_dir'
        git_env.execute_command_in_project('some_command')
        project_type_popen_patch.assert_called_once_with(
            'export PROJECT_DIR="proj_dir"; some_command',
            cwd=None,
            shell=ANY,
            stdout=ANY,
            stderr=ANY,
            start_new_session=ANY,
        )
开发者ID:linearregression,项目名称:ClusterRunner,代码行数:16,代码来源:test_git.py

示例2: test_execute_command_in_project_type_specifies_cwd_if_doesnt_exist

# 需要导入模块: from app.project_type.git import Git [as 别名]
# 或者: from app.project_type.git.Git import execute_command_in_project [as 别名]
    def test_execute_command_in_project_type_specifies_cwd_if_doesnt_exist(self):
        project_type_popen_patch = self._patch_popen()

        fake_project_directory = 'proj_dir'
        fake_command = 'some_command'
        git_env = Git("ssh://scm.dev.box.net/box/www/current", 'origin', 'refs/changes/78/151978/27')
        git_env.project_directory = fake_project_directory
        git_env.execute_command_in_project(fake_command)
        env_setter = get_environment_variable_setter_command('PROJECT_DIR', fake_project_directory)
        project_type_popen_patch.assert_called_once_with(
            '{} {}'.format(env_setter, fake_command),
            cwd=None,
            shell=ANY,
            stdout=ANY,
            stderr=ANY,
            start_new_session=ANY,
        )
开发者ID:Medium,项目名称:ClusterRunner,代码行数:19,代码来源:test_git.py

示例3: test_execute_command_in_project_type_specifies_cwd_if_doesnt_exist

# 需要导入模块: from app.project_type.git import Git [as 别名]
# 或者: from app.project_type.git.Git import execute_command_in_project [as 别名]
    def test_execute_command_in_project_type_specifies_cwd_if_doesnt_exist(self):
        os_path_exists_patch = self.patch('os.path.exists')
        os_path_exists_patch.return_value = False
        project_type_popen_patch = self.patch('app.project_type.project_type.Popen')
        project_type_popen_patch.return_value.communicate.return_value = None, None
        project_type_popen_patch.return_value.returncode = 0

        git_env = Git("ssh://scm.dev.box.net/box/www/current", 'origin', 'refs/changes/78/151978/27')
        git_env.project_directory = 'proj_dir'
        git_env.execute_command_in_project('some_command')
        project_type_popen_patch.assert_called_once_with(
            'export PROJECT_DIR="proj_dir"; some_command',
            stderr=-2,
            cwd=None,
            shell=True,
            stdout=-1
        )
开发者ID:drobertduke,项目名称:ClusterRunner,代码行数:19,代码来源:test_git.py

示例4: test_fetch_project_when_existing_repo_is_shallow_deletes_repo

# 需要导入模块: from app.project_type.git import Git [as 别名]
# 或者: from app.project_type.git.Git import execute_command_in_project [as 别名]
    def test_fetch_project_when_existing_repo_is_shallow_deletes_repo(self):
        self.os_path_isfile_mock.return_value = True
        self.os_path_exists_mock.return_value = True
        mock_fs = self.patch('app.project_type.git.fs')
        mock_rmtree = self.patch('shutil.rmtree')

        git = Git('url')
        git._repo_directory = 'fake/repo_path'
        git._execute_and_raise_on_failure = MagicMock()
        git.execute_command_in_project = Mock(return_value=('', 0))

        mock_fs.create_dir.call_count = 0  # only measure calls made in _fetch_project
        mock_rmtree.call_count = 0

        git._fetch_project()

        mock_rmtree.assert_called_once_with('fake/repo_path')
        mock_fs.create_dir.assert_called_once_with('fake/repo_path', Git.DIRECTORY_PERMISSIONS)
开发者ID:dncarley,项目名称:ClusterRunner,代码行数:20,代码来源:test_git.py

示例5: 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_command_in_project [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)
开发者ID:mdengler,项目名称:ClusterRunner,代码行数:21,代码来源:test_git.py

示例6: test_fetch_project_with_pre_shallow_cloned_repo

# 需要导入模块: from app.project_type.git import Git [as 别名]
# 或者: from app.project_type.git.Git import execute_command_in_project [as 别名]
    def test_fetch_project_with_pre_shallow_cloned_repo(self, shallow_clone, should_delete_clone):
        Configuration['shallow_clones'] = shallow_clone
        self.os_path_isfile_mock.return_value = True
        self.os_path_exists_mock.return_value = True
        mock_fs = self.patch('app.project_type.git.fs')
        mock_rmtree = self.patch('shutil.rmtree')

        git = Git('url')
        git._repo_directory = 'fake/repo_path'
        git._execute_and_raise_on_failure = MagicMock()
        git.execute_command_in_project = Mock(return_value=('', 0))

        mock_fs.create_dir.call_count = 0  # only measure calls made in _fetch_project
        mock_rmtree.call_count = 0

        git._fetch_project()

        if should_delete_clone:
            mock_rmtree.assert_called_once_with('fake/repo_path')
        else:
            self.assertFalse(mock_rmtree.called)
开发者ID:Medium,项目名称:ClusterRunner,代码行数:23,代码来源:test_git.py


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