• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python test_pip.run_pip函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中test_pip.run_pip函数的典型用法代码示例。如果您正苦于以下问题:Python run_pip函数的具体用法?Python run_pip怎么用?Python run_pip使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_config_file_override_stack

def test_config_file_override_stack():
    """
    Test config files (global, overriding a global config with a
    local, overriding all with a command line flag).
    
    """
    f, config_file = tempfile.mkstemp('-pip.cfg', 'test-')
    environ = clear_environ(os.environ.copy())
    environ['PIP_CONFIG_FILE'] = config_file # set this to make pip load it
    reset_env(environ)
    write_file(config_file, textwrap.dedent("""\
        [global]
        index-url = http://download.zope.org/ppix
        """))
    result = run_pip('install', '-vvv', 'INITools', expect_error=True)
    assert "Getting page http://download.zope.org/ppix/INITools" in result.stdout
    reset_env(environ)
    write_file(config_file, textwrap.dedent("""\
        [global]
        index-url = http://download.zope.org/ppix
        [install]
        index-url = http://pypi.appspot.com/
        """))
    result = run_pip('install', '-vvv', 'INITools', expect_error=True)
    assert "Getting page http://pypi.appspot.com/INITools" in result.stdout
    result = run_pip('install', '-vvv', '--index-url', 'http://pypi.python.org/simple', 'INITools', expect_error=True)
    assert "Getting page http://download.zope.org/ppix/INITools" not in result.stdout
    assert "Getting page http://pypi.appspot.com/INITools" not in result.stdout
    assert "Getting page http://pypi.python.org/simple/INITools" in result.stdout
开发者ID:dabrahams,项目名称:pip,代码行数:29,代码来源:test_config.py


示例2: test_cleanup_after_create_bundle

def test_cleanup_after_create_bundle():
    """
    Test clean up after making a bundle. Make sure (build|src)-bundle/ dirs are removed but not src/.

    """
    env = reset_env()
    # Install an editable to create a src/ dir.
    run_pip('install', '-e',
            '%s#egg=django-feedutil' %
            local_checkout('git+http://github.com/jezdez/django-feedutil.git'))
    build = env.venv_path/"build"
    src = env.venv_path/"src"
    assert not exists(build), "build/ dir still exists: %s" % build
    assert exists(src), "expected src/ dir doesn't exist: %s" % src

    # Make the bundle.
    fspkg = 'file://%s/FSPkg' %join(here, 'packages')
    pkg_lines = textwrap.dedent('''\
            -e %s
            -e %s#egg=initools-dev
            pip''' % (fspkg, local_checkout('svn+http://svn.colorstudy.com/INITools/trunk')))
    write_file('bundle-req.txt', pkg_lines)
    run_pip('bundle', '-r', 'bundle-req.txt', 'test.pybundle')
    build_bundle = env.scratch_path/"build-bundle"
    src_bundle = env.scratch_path/"src-bundle"
    assert not exists(build_bundle), "build-bundle/ dir still exists: %s" % build_bundle
    assert not exists(src_bundle), "src-bundle/ dir still exists: %s" % src_bundle

    # Make sure previously created src/ from editable still exists
    assert exists(src), "expected src dir doesn't exist: %s" % src
开发者ID:adieu,项目名称:pip,代码行数:30,代码来源:test_cleanup.py


示例3: test_freeze_with_local_option

def test_freeze_with_local_option():
    """
    Test that wsgiref (from global site-packages) is reported normally, but not with --local.

    """
    reset_env()
    result = run_pip('install', 'initools==0.2')
    result = run_pip('freeze', expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze
        -- stdout: --------------------
        INITools==0.2
        wsgiref==...
        <BLANKLINE>""")

    # The following check is broken (see
    # http://bitbucket.org/ianb/pip/issue/110).  For now we are simply
    # neutering this test, but if we can't find a way to fix it,
    # this whole function should be removed.

    # _check_output(result, expected)

    result = run_pip('freeze', '--local', expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze --local
        -- stdout: --------------------
        INITools==0.2
        <BLANKLINE>""")
    _check_output(result, expected)
开发者ID:hedberg,项目名称:pip,代码行数:29,代码来源:test_freeze.py


示例4: _test_config_file_override_stack

def _test_config_file_override_stack(config_file):
    environ = clear_environ(os.environ.copy())
    environ["PIP_CONFIG_FILE"] = config_file  # set this to make pip load it
    reset_env(environ)
    write_file(
        config_file,
        textwrap.dedent(
            """\
        [global]
        index-url = http://download.zope.org/ppix
        """
        ),
    )
    result = run_pip("install", "-vvv", "INITools", expect_error=True)
    assert "Getting page http://download.zope.org/ppix/INITools" in result.stdout
    reset_env(environ)
    write_file(
        config_file,
        textwrap.dedent(
            """\
        [global]
        index-url = http://download.zope.org/ppix
        [install]
        index-url = http://pypi.appspot.com/
        """
        ),
    )
    result = run_pip("install", "-vvv", "INITools", expect_error=True)
    assert "Getting page http://pypi.appspot.com/INITools" in result.stdout
    result = run_pip("install", "-vvv", "--index-url", "http://pypi.python.org/simple", "INITools", expect_error=True)
    assert "Getting page http://download.zope.org/ppix/INITools" not in result.stdout
    assert "Getting page http://pypi.appspot.com/INITools" not in result.stdout
    assert "Getting page http://pypi.python.org/simple/INITools" in result.stdout
开发者ID:mitsuhiko,项目名称:pip-1,代码行数:33,代码来源:test_config.py


示例5: test_freeze_mercurial_clone

def test_freeze_mercurial_clone():
    """
    Test freezing a Mercurial clone.

    """
    reset_env()
    env = get_env()
    result = env.run('hg', 'clone',
                     '-r', 'f8f7eaf275c5',
                     local_repo('hg+http://bitbucket.org/jezdez/django-dbtemplates'),
                     'django-dbtemplates')
    result = env.run('python', 'setup.py', 'develop',
            cwd=env.scratch_path/'django-dbtemplates')
    result = run_pip('freeze', expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze
        -- stdout: --------------------
        -e %[email protected]#egg=django_dbtemplates-...
        ...""" % local_checkout('hg+http://bitbucket.org/jezdez/django-dbtemplates'))
    _check_output(result, expected)

    result = run_pip('freeze', '-f',
                     '%s#egg=django_dbtemplates' % local_checkout('hg+http://bitbucket.org/jezdez/django-dbtemplates'),
                     expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze -f %(repo)s#egg=django_dbtemplates
        -- stdout: --------------------
        -f %(repo)s#egg=django_dbtemplates
        -e %(repo)[email protected]#egg=django_dbtemplates-...
        ...""" % {'repo': local_checkout('hg+http://bitbucket.org/jezdez/django-dbtemplates')})
    _check_output(result, expected)
开发者ID:hedberg,项目名称:pip,代码行数:31,代码来源:test_freeze.py


示例6: test_freeze_bazaar_clone

def test_freeze_bazaar_clone():
    """
    Test freezing a Bazaar clone.

    """
    reset_env()
    env = get_env()
    result = env.run('bzr', 'checkout', '-r', '174',
                     local_repo('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1'),
                     'django-wikiapp')
    result = env.run('python', 'setup.py', 'develop',
            cwd=env.scratch_path/'django-wikiapp')
    result = run_pip('freeze', expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze
        -- stdout: --------------------
        -e %[email protected]#egg=django_wikiapp-...
        ...""" % local_checkout('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1'))
    _check_output(result, expected)

    result = run_pip('freeze', '-f',
                     '%s/#egg=django-wikiapp' %
                     local_checkout('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1'),
                     expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze -f %(repo)s/#egg=django-wikiapp
        -- stdout: --------------------
        -f %(repo)s/#egg=django-wikiapp
        -e %(repo)[email protected]#egg=django_wikiapp-...
        ...""" % {'repo':
                  local_checkout('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1')})
    _check_output(result, expected)
开发者ID:hedberg,项目名称:pip,代码行数:32,代码来源:test_freeze.py


示例7: test_outdated_default

def test_outdated_default():
    """
    Test default behavor of oudated command
    """

    env = reset_env()
    total_re = re.compile('LATEST: +([0-9.]+)')
    write_file('initools-req.txt', textwrap.dedent("""\
        INITools==0.2
        # and something else to test out:
        simplejson==2.0.0
        """))
    run_pip('install', '-r', env.scratch_path/'initools-req.txt')
    result = run_pip('search', 'simplejson')
    simplejson_ver = total_re.search(str(result)).group(1)
    result = run_pip('search', 'INITools')
    initools_ver = total_re.search(str(result)).group(1)
    result = run_pip('outdated', expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: pip outdated
        -- stdout: --------------------
        simplejson==2.0.0 (LATEST: %s)
        INITools==0.2 (LATEST: %s)
        <BLANKLINE>""" % (simplejson_ver, initools_ver))
    _check_output(result, expected)
开发者ID:dgladkov,项目名称:pip,代码行数:25,代码来源:test_outdated.py


示例8: test_freeze_git_clone

def test_freeze_git_clone():
    """
    Test freezing a Git clone.

    """
    env = reset_env()
    result = env.run('git', 'clone', local_repo('git+http://github.com/jezdez/django-pagination.git'), 'django-pagination')
    result = env.run('git', 'checkout', '1df6507872d73ee387eb375428eafbfc253dfcd8',
            cwd=env.scratch_path/'django-pagination', expect_stderr=True)
    result = env.run('python', 'setup.py', 'develop',
            cwd=env.scratch_path / 'django-pagination')
    result = run_pip('freeze', expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze
        -- stdout: --------------------
        -e %[email protected]#egg=django_pagination-...
        ...""" % local_checkout('git+http://github.com/jezdez/django-pagination.git'))
    _check_output(result, expected)

    result = run_pip('freeze', '-f',
                     '%s#egg=django_pagination' % local_checkout('git+http://github.com/jezdez/django-pagination.git'),
                     expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: pip freeze -f %(repo)s#egg=django_pagination
        -- stdout: --------------------
        -f %(repo)s#egg=django_pagination
        -e %(repo)[email protected]#egg=django_pagination-...-dev
        ...""" % {'repo': local_checkout('git+http://github.com/jezdez/django-pagination.git')})
    _check_output(result, expected)
开发者ID:hedberg,项目名称:pip,代码行数:29,代码来源:test_freeze.py


示例9: _test_uninstall_editable_with_source_outside_venv

def _test_uninstall_editable_with_source_outside_venv(tmpdir):
    env = reset_env()
    result = env.run('hg', 'clone', local_repo('hg+http://bitbucket.org/ianb/virtualenv'), tmpdir)
    result2 = run_pip('install', '-e', tmpdir)
    assert (join(env.site_packages, 'virtualenv.egg-link') in result2.files_created), result2.files_created.keys()
    result3 = run_pip('uninstall', '-y', 'virtualenv', expect_error=True)
    assert_all_changes(result, result3, [env.venv/'build'])
开发者ID:adieu,项目名称:pip,代码行数:7,代码来源:test_uninstall.py


示例10: test_uninstall_from_reqs_file

def test_uninstall_from_reqs_file():
    """
    Test uninstall from a requirements file.

    """
    env = reset_env()
    write_file('test-req.txt', textwrap.dedent("""\
        -e %s#egg=initools-dev
        # and something else to test out:
        PyLogo<0.4
        """ % local_checkout('svn+http://svn.colorstudy.com/INITools/trunk')))
    result = run_pip('install', '-r', 'test-req.txt')
    write_file('test-req.txt', textwrap.dedent("""\
        # -f, -i, and --extra-index-url should all be ignored by uninstall
        -f http://www.example.com
        -i http://www.example.com
        --extra-index-url http://www.example.com

        -e %s#egg=initools-dev
        # and something else to test out:
        PyLogo<0.4
        """ % local_checkout('svn+http://svn.colorstudy.com/INITools/trunk')))
    result2 = run_pip('uninstall', '-r', 'test-req.txt', '-y')
    assert_all_changes(
        result, result2, [env.venv/'build', env.venv/'src', env.scratch/'test-req.txt'])
开发者ID:adieu,项目名称:pip,代码行数:25,代码来源:test_uninstall.py


示例11: test_create_bundle

def test_create_bundle():
    """
    Test making a bundle.  We'll grab one package from the filesystem
    (the FSPkg dummy package), one from vcs (initools) and one from an
    index (pip itself).

    """
    env = reset_env()
    fspkg = path_to_url2(Path(here) / "packages" / "FSPkg")
    dummy = run_pip("install", "-e", fspkg)
    pkg_lines = textwrap.dedent(
        """\
            -e %s
            -e svn+http://svn.colorstudy.com/INITools/trunk#egg=initools-dev
            pip"""
        % fspkg
    )
    write_file("bundle-req.txt", pkg_lines)
    # Create a bundle in env.scratch_path/ test.pybundle
    result = run_pip("bundle", "-r", env.scratch_path / "bundle-req.txt", env.scratch_path / "test.pybundle")
    bundle = result.files_after.get(join("scratch", "test.pybundle"), None)
    assert bundle is not None

    files = zipfile.ZipFile(bundle.full).namelist()
    assert "src/FSPkg/" in files
    assert "src/initools/" in files
    assert "build/pip/" in files
开发者ID:francescog,项目名称:pip,代码行数:27,代码来源:test_bundle.py


示例12: test_freeze_mercurial_clone

def test_freeze_mercurial_clone():
    """
    Test freezing a Mercurial clone.
    
    """
    reset_env()
    env = get_env()
    result = env.run(
        "hg", "clone", "-r", "f8f7eaf275c5", "http://bitbucket.org/jezdez/django-dbtemplates/", "django-dbtemplates"
    )
    result = env.run("python", "setup.py", "develop", cwd=env.scratch_path / "django-dbtemplates")
    result = run_pip("freeze", expect_stderr=True)
    expected = textwrap.dedent(
        """\
        Script result: ...pip freeze
        -- stdout: --------------------
        -e hg+http://bitbucket.org/jezdez/django-dbtemplates/@...#egg=django_dbtemplates-...
        ..."""
    )
    _check_output(result, expected)

    result = run_pip(
        "freeze", "-f", "hg+http://bitbucket.org/jezdez/django-dbtemplates#egg=django_dbtemplates", expect_stderr=True
    )
    expected = textwrap.dedent(
        """\
        Script result: ...pip freeze -f hg+http://bitbucket.org/jezdez/django-dbtemplates#egg=django_dbtemplates
        -- stdout: --------------------
        -f hg+http://bitbucket.org/jezdez/django-dbtemplates#egg=django_dbtemplates
        -e hg+http://bitbucket.org/jezdez/django-dbtemplates/@...#egg=django_dbtemplates-...
        ..."""
    )
    _check_output(result, expected)
开发者ID:francescog,项目名称:pip,代码行数:33,代码来源:test_freeze.py


示例13: test_no_upgrade_unless_requested

def test_no_upgrade_unless_requested():
    """
    No upgrade if not specifically requested.

    """
    reset_env()
    run_pip('install', 'INITools==0.1', expect_error=True)
    result = run_pip('install', 'INITools', expect_error=True)
    assert not result.files_created, 'pip install INITools upgraded when it should not have'
开发者ID:hedberg,项目名称:pip,代码行数:9,代码来源:test_upgrade.py


示例14: test_upgrade_if_requested

def test_upgrade_if_requested():
    """
    And it does upgrade if requested.

    """
    reset_env()
    run_pip('install', 'INITools==0.1', expect_error=True)
    result = run_pip('install', '--upgrade', 'INITools', expect_error=True)
    assert result.files_created, 'pip install --upgrade did not upgrade'
开发者ID:hotsyk,项目名称:pip,代码行数:9,代码来源:test_upgrade.py


示例15: test_upgrade_to_specific_version

def test_upgrade_to_specific_version():
    """
    It does upgrade to specific version requested.

    """
    reset_env()
    run_pip('install', 'INITools==0.1', expect_error=True)
    result = run_pip('install', 'INITools==0.2', expect_error=True)
    assert result.files_created, 'pip install with specific version did not upgrade'
开发者ID:hotsyk,项目名称:pip,代码行数:9,代码来源:test_upgrade.py


示例16: test_simple_uninstall

def test_simple_uninstall():
    """
    Test simple install and uninstall.

    """
    env = reset_env()
    result = run_pip('install', 'INITools==0.2', expect_error=True)
    assert join(env.site_packages, 'initools') in result.files_created, sorted(result.files_created.keys())
    result2 = run_pip('uninstall', 'INITools', '-y', expect_error=True)
    assert_all_changes(result, result2, [env.venv/'build', 'cache'])
开发者ID:adieu,项目名称:pip,代码行数:10,代码来源:test_uninstall.py


示例17: test_upgrade_if_requested

def test_upgrade_if_requested():
    """
    And it does upgrade if requested.

    """
    env = reset_env()
    run_pip('install', 'INITools==0.1', expect_error=True)
    result = run_pip('install', '--upgrade', 'INITools', expect_error=True)
    assert result.files_created, 'pip install --upgrade did not upgrade'
    assert env.site_packages/'INITools-0.1-py%s.egg-info' % pyversion not in result.files_created
开发者ID:hedberg,项目名称:pip,代码行数:10,代码来源:test_upgrade.py


示例18: test_uninstall_console_scripts

def test_uninstall_console_scripts():
    """
    Test uninstalling a package with more files (console_script entry points, extra directories).

    """
    env = reset_env()
    result = run_pip('install', 'virtualenv', expect_error=True)
    assert env.bin/'virtualenv'+env.exe in result.files_created, sorted(result.files_created.keys())
    result2 = run_pip('uninstall', 'virtualenv', '-y', expect_error=True)
    assert_all_changes(result, result2, [env.venv/'build', 'cache'])
开发者ID:adieu,项目名称:pip,代码行数:10,代码来源:test_uninstall.py


示例19: test_cleanup_after_install_from_pypi

def test_cleanup_after_install_from_pypi():
    """
    Test clean up after installing a package from PyPI.

    """
    env = reset_env()
    run_pip('install', 'INITools==0.2', expect_error=True)
    build = env.scratch_path/"build"
    src = env.scratch_path/"src"
    assert not exists(build), "build/ dir still exists: %s" % build
    assert not exists(src), "unexpected src/ dir exists: %s" % src
开发者ID:adieu,项目名称:pip,代码行数:11,代码来源:test_cleanup.py


示例20: test_uninstall_editable_from_svn

def test_uninstall_editable_from_svn():
    """
    Test uninstalling an editable installation from svn.
    
    """
    env = reset_env()
    result = run_pip('install', '-e', 'svn+http://svn.colorstudy.com/INITools/trunk#egg=initools-dev')
    result.assert_installed('INITools')
    result2 = run_pip('uninstall', '-y', 'initools')
    assert (env.venv/'src'/'initools' in result2.files_after), 'oh noes, pip deleted my sources!'
    assert_all_changes(result, result2, [env.venv/'src', env.venv/'build'])
开发者ID:dabrahams,项目名称:pip,代码行数:11,代码来源:test_uninstall.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python models.InheritedModel类代码示例发布时间:2022-05-27
下一篇:
Python test_pip.reset_env函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap