当前位置: 首页>>代码示例>>Python>>正文


Python test_pip.reset_env函数代码示例

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


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


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