本文整理汇总了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']
示例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']
示例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)
示例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)