本文整理汇总了Python中tests.lib._create_test_package函数的典型用法代码示例。如果您正苦于以下问题:Python _create_test_package函数的具体用法?Python _create_test_package怎么用?Python _create_test_package使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_create_test_package函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_freeze_bazaar_clone
def test_freeze_bazaar_clone(script, tmpdir):
"""
Test freezing a Bazaar clone.
"""
try:
checkout_path = _create_test_package(script, vcs='bazaar')
except OSError as e:
pytest.fail('Invoking `bzr` failed: %s' % e)
result = script.run(
'bzr', 'checkout', checkout_path, 'bzr-package'
)
result = script.run(
'python', 'setup.py', 'develop',
cwd=script.scratch_path / 'bzr-package',
expect_stderr=True,
)
result = script.pip('freeze', expect_stderr=True)
expected = textwrap.dedent("""\
...-e bzr+file://[email protected]#egg=version_pkg
...""")
_check_output(result.stdout, expected)
result = script.pip(
'freeze', '-f',
'%s/#egg=django-wikiapp' % checkout_path,
expect_stderr=True,
)
expected = textwrap.dedent("""\
-f %(repo)s/#egg=django-wikiapp
...-e bzr+file://[email protected]#egg=version_pkg
...""" % {'repo': checkout_path})
_check_output(result.stdout, expected)
开发者ID:alquerci,项目名称:pip,代码行数:34,代码来源:test_freeze.py
示例2: test_freeze_git_clone
def test_freeze_git_clone(script, tmpdir):
"""
Test freezing a Git clone.
"""
# Returns path to a generated package called "version_pkg"
pkg_version = _create_test_package(script)
result = script.run(
'git', 'clone', pkg_version, 'pip-test-package',
expect_stderr=True,
)
repo_dir = script.scratch_path / 'pip-test-package'
result = script.run(
'python', 'setup.py', 'develop',
cwd=repo_dir,
expect_stderr=True,
)
result = script.pip('freeze', expect_stderr=True)
expected = textwrap.dedent(
"""
...-e git+...#egg=version_pkg
...
"""
).strip()
_check_output(result.stdout, expected)
result = script.pip(
'freeze', '-f', '%s#egg=pip_test_package' % repo_dir,
expect_stderr=True,
)
expected = textwrap.dedent(
"""
-f %(repo)s#egg=pip_test_package...
-e git+...#egg=version_pkg
...
""" % {'repo': repo_dir},
).strip()
_check_output(result.stdout, expected)
# Check that slashes in branch or tag names are translated.
# See also issue #1083: https://github.com/pypa/pip/issues/1083
script.run(
'git', 'checkout', '-b', 'branch/name/with/slash',
cwd=repo_dir,
expect_stderr=True,
)
# Create a new commit to ensure that the commit has only one branch
# or tag name associated to it (to avoid the non-determinism reported
# in issue #1867).
script.run('touch', 'newfile', cwd=repo_dir)
script.run('git', 'add', 'newfile', cwd=repo_dir)
script.run('git', 'commit', '-m', '...', cwd=repo_dir)
result = script.pip('freeze', expect_stderr=True)
expected = textwrap.dedent(
"""
...-e [email protected]#egg=version_pkg
...
"""
).strip()
_check_output(result.stdout, expected)
开发者ID:alquerci,项目名称:pip,代码行数:60,代码来源:test_freeze.py
示例3: test_freeze_exclude_editable
def test_freeze_exclude_editable(script, tmpdir):
"""
Test excluding editable from freezing list.
"""
# Returns path to a generated package called "version_pkg"
pkg_version = _create_test_package(script)
result = script.run(
'git', 'clone', pkg_version, 'pip-test-package',
expect_stderr=True,
)
repo_dir = script.scratch_path / 'pip-test-package'
result = script.run(
'python', 'setup.py', 'develop',
cwd=repo_dir,
expect_stderr=True,
)
result = script.pip('freeze', '--exclude-editable', expect_stderr=True)
expected = textwrap.dedent(
"""
...-e git+...#egg=version_pkg
...
"""
).strip()
_check_output(result.stdout, expected)
开发者ID:alquerci,项目名称:pip,代码行数:25,代码来源:test_freeze.py
示例4: test_reinstalling_works_with_editible_non_master_branch
def test_reinstalling_works_with_editible_non_master_branch(script):
"""
Reinstalling an editable installation should not assume that the "master"
branch exists. See https://github.com/pypa/pip/issues/4448.
"""
version_pkg_path = _create_test_package(script)
# Switch the default branch to something other than 'master'
script.run('git', 'branch', '-m', 'foobar', cwd=version_pkg_path)
script.pip(
'install', '-e',
'%s#egg=version_pkg' %
('git+file://' + version_pkg_path.abspath.replace('\\', '/')),
)
version = script.run('version_pkg')
assert '0.1' in version.stdout
_change_test_package_version(script, version_pkg_path)
script.pip(
'install', '-e',
'%s#egg=version_pkg' %
('git+file://' + version_pkg_path.abspath.replace('\\', '/')),
)
version = script.run('version_pkg')
assert 'some different version' in version.stdout
开发者ID:vtitor,项目名称:pip,代码行数:26,代码来源:test_install_vcs.py
示例5: _test_install_editable_from_git
def _test_install_editable_from_git(script, tmpdir, wheel):
"""Test cloning from Git."""
if wheel:
script.pip('install', 'wheel')
pkg_path = _create_test_package(script, name='testpackage', vcs='git')
args = ['install', '-e', 'git+%s#egg=testpackage' % path_to_url(pkg_path)]
result = script.pip(*args, **{"expect_error": True})
result.assert_installed('testpackage', with_files=['.git'])
开发者ID:nvdv,项目名称:pip,代码行数:8,代码来源:test_install.py
示例6: test_vcs_url_final_slash_normalization
def test_vcs_url_final_slash_normalization(script, tmpdir):
"""
Test that presence or absence of final slash in VCS URL is normalized.
"""
pkg_path = _create_test_package(script, name='testpackage', vcs='hg')
args = ['install', '-e', 'hg+%s/#egg=testpackage' % path_to_url(pkg_path)]
result = script.pip(*args, **{"expect_error": True})
result.assert_installed('testpackage', with_files=['.hg'])
开发者ID:alquerci,项目名称:pip,代码行数:8,代码来源:test_install.py
示例7: test_get_refs_should_return_branch_name_and_commit_pair
def test_get_refs_should_return_branch_name_and_commit_pair(script):
version_pkg_path = _create_test_package(script)
script.run('git', 'branch', 'branch0.1', cwd=version_pkg_path)
commit = script.run('git', 'rev-parse', 'HEAD',
cwd=version_pkg_path).stdout.strip()
git = Git()
result = git.get_refs(version_pkg_path)
assert result['master'] == commit, result
assert result['branch0.1'] == commit, result
开发者ID:1stvamp,项目名称:pip,代码行数:9,代码来源:test_install_vcs_git.py
示例8: test_git_with_tag_name_as_revision
def test_git_with_tag_name_as_revision(script):
"""
Git backend should be able to install from tag names
"""
version_pkg_path = _create_test_package(script)
script.run('git', 'tag', 'test_tag', expect_stderr=True, cwd=version_pkg_path)
_change_test_package_version(script, version_pkg_path)
script.pip('install', '-e', '%[email protected]_tag#egg=version_pkg' % ('git+file://' + version_pkg_path.abspath.replace('\\', '/')))
version = script.run('version_pkg')
assert '0.1' in version.stdout
开发者ID:1stvamp,项目名称:pip,代码行数:10,代码来源:test_install_vcs.py
示例9: test_git_with_branch_name_as_revision
def test_git_with_branch_name_as_revision(script):
"""
Git backend should be able to install from branch names
"""
version_pkg_path = _create_test_package(script)
script.run('git', 'checkout', '-b', 'test_branch', expect_stderr=True, cwd=version_pkg_path)
_change_test_package_version(script, version_pkg_path)
script.pip('install', '-e', '%[email protected]_branch#egg=version_pkg' % ('git+file://' + version_pkg_path.abspath.replace('\\', '/')))
version = script.run('version_pkg')
assert 'some different version' in version.stdout
开发者ID:1stvamp,项目名称:pip,代码行数:10,代码来源:test_install_vcs.py
示例10: test_git_with_sha1_revisions
def test_git_with_sha1_revisions(script):
"""
Git backend should be able to install from SHA1 revisions
"""
version_pkg_path = _create_test_package(script)
_change_test_package_version(script, version_pkg_path)
sha1 = script.run('git', 'rev-parse', 'HEAD~1', cwd=version_pkg_path).stdout.strip()
script.pip('install', '-e', '%[email protected]%s#egg=version_pkg' % ('git+file://' + version_pkg_path.abspath.replace('\\', '/'), sha1))
version = script.run('version_pkg')
assert '0.1' in version.stdout, version.stdout
开发者ID:1stvamp,项目名称:pip,代码行数:10,代码来源:test_install_vcs.py
示例11: test_git_works_with_editable_non_origin_repo
def test_git_works_with_editable_non_origin_repo(script):
# set up, create a git repo and install it as editable from a local directory path
version_pkg_path = _create_test_package(script)
script.pip('install', '-e', version_pkg_path.abspath)
# 'freeze'ing this should not fall over, but should result in stderr output warning
result = script.pip('freeze', expect_stderr=True)
assert "Error when trying to get requirement" in result.stderr
assert "Could not determine repository location" in result.stdout
assert "version-pkg==0.1" in result.stdout
开发者ID:1stvamp,项目名称:pip,代码行数:10,代码来源:test_install_vcs.py
示例12: test_get_refs_should_return_tag_name_and_commit_pair
def test_get_refs_should_return_tag_name_and_commit_pair():
env = reset_env()
version_pkg_path = _create_test_package(env)
env.run('git', 'tag', '0.1', cwd=version_pkg_path)
env.run('git', 'tag', '0.2', cwd=version_pkg_path)
commit = env.run('git', 'rev-parse', 'HEAD',
cwd=version_pkg_path).stdout.strip()
git = Git()
result = git.get_refs(version_pkg_path)
assert result['0.1'] == commit, result
assert result['0.2'] == commit, result
开发者ID:Basis,项目名称:pip,代码行数:11,代码来源:test_install_vcs_git.py
示例13: test_install_editable_from_svn
def test_install_editable_from_svn(script):
"""
Test checking out from svn.
"""
checkout_path = _create_test_package(script)
repo_url = _create_svn_repo(script, checkout_path)
result = script.pip(
'install',
'-e', 'svn+' + repo_url + '#egg=version-pkg'
)
result.assert_installed('version-pkg', with_files=['.svn'])
开发者ID:alquerci,项目名称:pip,代码行数:11,代码来源:test_install.py
示例14: test_git_install_branch_again_after_branch_changes
def test_git_install_branch_again_after_branch_changes(script):
"""
Test installing a branch again after the branch is updated in the remote
repository.
"""
version_pkg_path = _create_test_package(script)
version = _install_version_pkg(script, version_pkg_path, rev='master')
assert version == '0.1'
_change_test_package_version(script, version_pkg_path)
version = _install_version_pkg(script, version_pkg_path, rev='master')
assert version == 'some different version'
开发者ID:jonparrott,项目名称:pip,代码行数:12,代码来源:test_install_vcs_git.py
示例15: test_get_refs_should_ignore_no_branch
def test_get_refs_should_ignore_no_branch(script):
version_pkg_path = _create_test_package(script)
script.run('git', 'branch', 'branch0.1', cwd=version_pkg_path)
commit = script.run('git', 'rev-parse', 'HEAD',
cwd=version_pkg_path).stdout.strip()
# current branch here is "* (nobranch)"
script.run('git', 'checkout', commit,
cwd=version_pkg_path, expect_stderr=True)
git = Git()
result = git.get_refs(version_pkg_path)
assert result['master'] == commit, result
assert result['branch0.1'] == commit, result
开发者ID:1stvamp,项目名称:pip,代码行数:12,代码来源:test_install_vcs_git.py
示例16: test_git_with_ambiguous_revs
def test_git_with_ambiguous_revs(script):
"""
Test git with two "names" (tag/branch) pointing to the same commit
"""
version_pkg_path = _create_test_package(script)
version_pkg_url = _make_version_pkg_url(version_pkg_path, rev='0.1')
script.run('git', 'tag', '0.1', cwd=version_pkg_path)
result = script.pip('install', '-e', version_pkg_url)
assert 'Could not find a tag or branch' not in result.stdout
# it is 'version-pkg' instead of 'version_pkg' because
# egg-link name is version-pkg.egg-link because it is a single .py module
result.assert_installed('version-pkg', with_files=['.git'])
开发者ID:jonparrott,项目名称:pip,代码行数:12,代码来源:test_install_vcs_git.py
示例17: test_editable__no_revision
def test_editable__no_revision(script):
"""
Test a basic install in editable mode specifying no revision.
"""
version_pkg_path = _create_test_package(script)
_install_version_pkg_only(script, version_pkg_path)
branch = _get_editable_branch(script, 'version-pkg')
assert branch == 'master'
remote = _get_branch_remote(script, 'version-pkg', 'master')
assert remote == 'origin'
开发者ID:jonparrott,项目名称:pip,代码行数:12,代码来源:test_install_vcs_git.py
示例18: test_check_version
def test_check_version(script):
version_pkg_path = _create_test_package(script)
script.run('git', 'branch', 'branch0.1', cwd=version_pkg_path)
commit = script.run(
'git', 'rev-parse', 'HEAD',
cwd=version_pkg_path
).stdout.strip()
git = Git()
assert git.check_version(version_pkg_path, [commit])
assert git.check_version(version_pkg_path, [commit[:7]])
assert not git.check_version(version_pkg_path, ['branch0.1'])
assert not git.check_version(version_pkg_path, ['abc123'])
开发者ID:AndydeCleyre,项目名称:pip,代码行数:12,代码来源:test_install_vcs_git.py
示例19: test_git_install_ref
def test_git_install_ref(script):
"""
The Git backend should be able to install a ref with the first install.
"""
version_pkg_path = _create_test_package(script)
_add_ref(script, version_pkg_path, 'refs/foo/bar')
_change_test_package_version(script, version_pkg_path)
version = _install_version_pkg(
script, version_pkg_path, rev='refs/foo/bar', expect_stderr=True,
)
assert '0.1' == version
开发者ID:jonparrott,项目名称:pip,代码行数:12,代码来源:test_install_vcs_git.py
示例20: test_editable_git_upgrade
def test_editable_git_upgrade(script):
"""
Test installing an editable git package from a repository, upgrading the repository,
installing again, and check it gets the newer version
"""
version_pkg_path = _create_test_package(script)
script.pip('install', '-e', '%s#egg=version_pkg' % ('git+file://' + version_pkg_path))
version = script.run('version_pkg')
assert '0.1' in version.stdout
_change_test_package_version(script, version_pkg_path)
script.pip('install', '-e', '%s#egg=version_pkg' % ('git+file://' + version_pkg_path))
version2 = script.run('version_pkg')
assert 'some different version' in version2.stdout, "Output: %s" % (version2.stdout)
开发者ID:1stvamp,项目名称:pip,代码行数:13,代码来源:test_install_upgrade.py
注:本文中的tests.lib._create_test_package函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论