本文整理汇总了Python中pip.vcs.git.Git.get_url方法的典型用法代码示例。如果您正苦于以下问题:Python Git.get_url方法的具体用法?Python Git.get_url怎么用?Python Git.get_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pip.vcs.git.Git
的用法示例。
在下文中一共展示了Git.get_url方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_git_get_src_requirements
# 需要导入模块: from pip.vcs.git import Git [as 别名]
# 或者: from pip.vcs.git.Git import get_url [as 别名]
def test_git_get_src_requirements():
git_url = "http://github.com/pypa/pip-test-package"
refs = {
"0.1": "a8992fc7ee17e5b9ece022417b64594423caca7c",
"0.1.1": "7d654e66c8fa7149c165ddeffa5b56bc06619458",
"0.1.2": "f1c1020ebac81f9aeb5c766ff7a772f709e696ee",
"foo": "5547fa909e83df8bd743d3978d6667497983a4b7",
"bar": "5547fa909e83df8bd743d3978d6667497983a4b7",
"master": "5547fa909e83df8bd743d3978d6667497983a4b7",
"origin/master": "5547fa909e83df8bd743d3978d6667497983a4b7",
"origin/HEAD": "5547fa909e83df8bd743d3978d6667497983a4b7",
}
sha = refs["foo"]
git = Git()
git.get_url = Mock(return_value=git_url)
git.get_revision = Mock(return_value=sha)
git.get_refs = Mock(return_value=refs)
dist = Mock()
dist.egg_name = Mock(return_value="pip_test_package")
ret = git.get_src_requirement(dist, location=".", find_tags=None)
assert ret == "".join(
[
"git+http://github.com/pypa/pip-test-package",
"@5547fa909e83df8bd743d3978d6667497983a4b7",
"#egg=pip_test_package-bar",
]
)
示例2: git
# 需要导入模块: from pip.vcs.git import Git [as 别名]
# 或者: from pip.vcs.git.Git import get_url [as 别名]
def git():
git_url = 'http://github.com/pypa/pip-test-package'
refs = {
'0.1': 'a8992fc7ee17e5b9ece022417b64594423caca7c',
'0.1.1': '7d654e66c8fa7149c165ddeffa5b56bc06619458',
'0.1.2': 'f1c1020ebac81f9aeb5c766ff7a772f709e696ee',
'foo': '5547fa909e83df8bd743d3978d6667497983a4b7',
'bar': '5547fa909e83df8bd743d3978d6667497983a4b7',
'master': '5547fa909e83df8bd743d3978d6667497983a4b7',
'origin/master': '5547fa909e83df8bd743d3978d6667497983a4b7',
'origin/HEAD': '5547fa909e83df8bd743d3978d6667497983a4b7',
}
sha = refs['foo']
git = Git()
git.get_url = Mock(return_value=git_url)
git.get_revision = Mock(return_value=sha)
git.get_short_refs = Mock(return_value=refs)
return git