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

Python test_pip.reset_env函数代码示例

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

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



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

示例1: test_install_with_pax_header

def test_install_with_pax_header():
    """
    test installing from a tarball with pax header for python<2.6
    """
    reset_env()
    run_from = abspath(join(here, 'packages'))
    result = run_pip('install', 'paxpkg.tar.bz2', cwd=run_from)
开发者ID:adieu,项目名称:pip,代码行数:7,代码来源:test_basic.py


示例2: 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


示例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_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


示例5: _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


示例6: 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


示例7: 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


示例8: test_bad_install_with_no_download

def test_bad_install_with_no_download():
    """
    Test that --no-download behaves sensibly if the package source can't be found.
    """
    reset_env()
    result = run_pip('install', 'INITools==0.2', '--no-download', expect_error=True)
    assert "perhaps --no-download was used without first running "\
            "an equivalent install with --no-install?" in result.stdout
开发者ID:adieu,项目名称:pip,代码行数:8,代码来源:test_basic.py


示例9: test_search

def test_search():
    """
    End to end test of search command.
    
    """
    reset_env()
    output = run_pip('search', 'pip', expect_error=True)
    assert 'pip installs packages' in output.stdout
开发者ID:dabrahams,项目名称:pip,代码行数:8,代码来源:test_search.py


示例10: test_vcs_url_urlquote_normalization

def test_vcs_url_urlquote_normalization():
    """
    Test that urlquoted characters are normalized for repo URL comparison.
    
    """
    reset_env()
    result = run_pip('install', '-e', 'bzr+http://bazaar.launchpad.net/~django-wikiapp/django-wikiapp/release-0.1#egg=django-wikiapp', expect_error=True)
    assert 'pip-log.txt' not in result.files_created, result.files_created['pip-log.txt'].bytes
开发者ID:dabrahams,项目名称:pip,代码行数:8,代码来源:test_basic.py


示例11: test_vcs_url_final_slash_normalization

def test_vcs_url_final_slash_normalization():
    """
    Test that presence or absence of final slash in VCS URL is normalized.
    
    """
    reset_env()
    result = run_pip('install', '-e', 'hg+http://bitbucket.org/ubernostrum/django-registration#egg=django-registration', expect_error=True)
    assert 'pip-log.txt' not in result.files_created, result.files_created['pip-log.txt'].bytes
开发者ID:dabrahams,项目名称:pip,代码行数:8,代码来源:test_basic.py


示例12: test_install_global_option

def test_install_global_option():
    """
    Test using global distutils options.
    (In particular those that disable the actual install action)
    """
    reset_env()
    result = run_pip('install', '--global-option=--version', "INITools==0.1")
    assert '0.1\n' in result.stdout
开发者ID:adieu,项目名称:pip,代码行数:8,代码来源:test_basic.py


示例13: test_git_with_editable_where_egg_contains_dev_string

def test_git_with_editable_where_egg_contains_dev_string():
    """
    Test cloning a git repository from an editable url witch contains "dev" string
    """
    reset_env()
    result = run_pip('install', '-e', '%s#egg=django-devserver' %
                     local_checkout('git+git://github.com/dcramer/django-devserver.git'))
    result.assert_installed('django-devserver', with_files=['.git'])
开发者ID:adieu,项目名称:pip,代码行数:8,代码来源:test_vcs_backends.py


示例14: test_completion_for_unknown_shell

def test_completion_for_unknown_shell():
    """
    Test getting completion for an unknown shell
    """
    reset_env()
    error_msg = 'error: no such option: --myfooshell'
    result = run_pip('completion', '--myfooshell', expect_error=True)
    assert error_msg in result.stderr, 'tests for an unknown shell failed'
开发者ID:adieu,项目名称:pip,代码行数:8,代码来源:test_completion.py


示例15: test_completion_alone

def test_completion_alone():
    """
    Test getting completion for none shell, just pip completion
    """
    reset_env()
    result = run_pip('completion', expect_error=True)
    assert 'ERROR: You must pass --bash or --zsh' in result.stderr,\
            'completion alone failed -- ' + result.stderr
开发者ID:adieu,项目名称:pip,代码行数:8,代码来源:test_completion.py


示例16: test_install_global_option_using_editable

def test_install_global_option_using_editable():
    """
    Test using global distutils options, but in an editable installation
    """
    reset_env()
    result = run_pip('install', '--global-option=--version',
                     '-e', '%s#egg=virtualenv' %
                      local_checkout('hg+http://bitbucket.org/ianb/[email protected]'))
    assert '1.4.1\n' in result.stdout
开发者ID:adieu,项目名称:pip,代码行数:9,代码来源:test_basic.py


示例17: test_editable_install

def test_editable_install():
    """
    Test editable installation.
    """
    reset_env()
    result = run_pip('install', '-e', 'INITools==0.2', expect_error=True)
    assert "--editable=INITools==0.2 should be formatted with svn+URL" in result.stdout
    assert len(result.files_created) == 1, result.files_created
    assert not result.files_updated, result.files_updated
开发者ID:adieu,项目名称:pip,代码行数:9,代码来源:test_basic.py


示例18: 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


示例19: 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


示例20: test_git_with_non_editable_unpacking

def test_git_with_non_editable_unpacking():
    """
    Test cloning a git repository from a non-editable URL with a given tag.
    """
    reset_env()
    result = run_pip('install', '--global-option=--version', local_checkout(
                     'git+http://github.com/jezdez/[email protected]#egg=django-staticfiles'
                     ), expect_error=True)
    assert '0.3.1\n' in result.stdout
开发者ID:hedberg,项目名称:pip,代码行数:9,代码来源:test_vcs_backends.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python test_pip.run_pip函数代码示例发布时间:2022-05-27
下一篇:
Python test_p2p_grpform.remove_group函数代码示例发布时间: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