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


Python Git.run_command方法代码示例

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


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

示例1: test_git_dir_ignored

# 需要导入模块: from pip._internal.vcs.git import Git [as 别名]
# 或者: from pip._internal.vcs.git.Git import run_command [as 别名]
def test_git_dir_ignored():
    """
    Test that a GIT_DIR environment variable is ignored.
    """
    git = Git()
    with TempDirectory() as temp:
        temp_dir = temp.path
        env = {'GIT_DIR': 'foo'}
        # If GIT_DIR is not ignored, then os.listdir() will return ['foo'].
        git.run_command(['init', temp_dir], cwd=temp_dir, extra_environ=env)
        assert os.listdir(temp_dir) == ['.git']
开发者ID:jaraco,项目名称:pip,代码行数:13,代码来源:test_vcs_git.py

示例2: test_git_dir_ignored

# 需要导入模块: from pip._internal.vcs.git import Git [as 别名]
# 或者: from pip._internal.vcs.git.Git import run_command [as 别名]
def test_git_dir_ignored(tmpdir):
    """
    Test that a GIT_DIR environment variable is ignored.
    """
    repo_path = tmpdir / 'test-repo'
    repo_path.mkdir()
    repo_dir = str(repo_path)

    env = {'GIT_DIR': 'foo'}
    # If GIT_DIR is not ignored, then os.listdir() will return ['foo'].
    Git.run_command(['init', repo_dir], cwd=repo_dir, extra_environ=env)
    assert os.listdir(repo_dir) == ['.git']
开发者ID:cjerdonek,项目名称:pip,代码行数:14,代码来源:test_vcs_git.py

示例3: test_git_work_tree_ignored

# 需要导入模块: from pip._internal.vcs.git import Git [as 别名]
# 或者: from pip._internal.vcs.git.Git import run_command [as 别名]
def test_git_work_tree_ignored():
    """
    Test that a GIT_WORK_TREE environment variable is ignored.
    """
    git = Git()
    with TempDirectory() as temp:
        temp_dir = temp.path
        git.run_command(['init', temp_dir], cwd=temp_dir)
        # Choose a directory relative to the cwd that does not exist.
        # If GIT_WORK_TREE is not ignored, then the command will error out
        # with: "fatal: This operation must be run in a work tree".
        env = {'GIT_WORK_TREE': 'foo'}
        git.run_command(['status', temp_dir], extra_environ=env, cwd=temp_dir)
开发者ID:jaraco,项目名称:pip,代码行数:15,代码来源:test_vcs_git.py

示例4: test_git_work_tree_ignored

# 需要导入模块: from pip._internal.vcs.git import Git [as 别名]
# 或者: from pip._internal.vcs.git.Git import run_command [as 别名]
def test_git_work_tree_ignored(tmpdir):
    """
    Test that a GIT_WORK_TREE environment variable is ignored.
    """
    repo_path = tmpdir / 'test-repo'
    repo_path.mkdir()
    repo_dir = str(repo_path)

    Git.run_command(['init', repo_dir], cwd=repo_dir)
    # Choose a directory relative to the cwd that does not exist.
    # If GIT_WORK_TREE is not ignored, then the command will error out
    # with: "fatal: This operation must be run in a work tree".
    env = {'GIT_WORK_TREE': 'foo'}
    Git.run_command(['status', repo_dir], extra_environ=env, cwd=repo_dir)
开发者ID:cjerdonek,项目名称:pip,代码行数:16,代码来源:test_vcs_git.py


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