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


Python lib.reset_env函数代码示例

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


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

示例1: test_freeze_with_requirement_option

def test_freeze_with_requirement_option():
    """
    Test that new requirements are created correctly with --requirement hints

    """
    reset_env()
    ignores = textwrap.dedent("""\
        # Unchanged requirements below this line
        -r ignore.txt
        --requirement ignore.txt
        -Z ignore
        --always-unzip ignore
        -f http://ignore
        -i http://ignore
        --extra-index-url http://ignore
        --find-links http://ignore
        --index-url http://ignore
        """)
    write_file('hint.txt', textwrap.dedent("""\
        INITools==0.1
        NoExist==4.2
        """) + ignores)
    result = run_pip('install', 'initools==0.2')
    result = pip_install_local('simple')
    result = run_pip('freeze', '--requirement', 'hint.txt', expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: pip freeze --requirement hint.txt
        -- stderr: --------------------
        Requirement file contains NoExist==4.2, but that package is not installed

        -- stdout: --------------------
        INITools==0.2
        """) + ignores + "## The following requirements were added by pip --freeze:..."
    _check_output(result, expected)
开发者ID:Basis,项目名称:pip,代码行数:34,代码来源:test_freeze.py

示例2: test_reset_env_system_site_packages

 def test_reset_env_system_site_packages(self):
     """
     Test using system_site_packages with reset_env resets the venv cache
     """
     env = reset_env(system_site_packages=True)
     env = reset_env()
     assert not os.path.isfile(self.env.backup_path / self.env.venv / 'test_file')
开发者ID:Basis,项目名称:pip,代码行数:7,代码来源:test_lib.py

示例3: test_freeze_bazaar_clone

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

    """

    checkout_path = local_checkout('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1')
    #bzr internally stores windows drives as uppercase; we'll match that.
    checkout_pathC = checkout_path.replace('c:', 'C:')

    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-...
        ...""" % checkout_pathC)
    _check_output(result, expected)

    result = run_pip('freeze', '-f',
                     '%s/#egg=django-wikiapp' % checkout_path,
                     expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze -f %(repo)s/#egg=django-wikiapp
        -- stdout: --------------------
        -f %(repo)s/#egg=django-wikiapp
        ...-e %(repoC)[email protected]#egg=django_wikiapp-...
        ...""" % {'repoC': checkout_pathC, 'repo': checkout_path})
    _check_output(result, expected)
开发者ID:Basis,项目名称:pip,代码行数:35,代码来源:test_freeze.py

示例4: 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:Basis,项目名称:pip,代码行数:29,代码来源:test_freeze.py

示例5: test_help_command_should_exit_status_error_when_command_does_not_exist

def test_help_command_should_exit_status_error_when_command_does_not_exist():
    """
    Test `help` command for non-existing command
    """
    reset_env()
    result = run_pip('help', 'mycommand', expect_error=True)
    assert result.returncode == ERROR
开发者ID:Basis,项目名称:pip,代码行数:7,代码来源:test_help.py

示例6: 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', 'c9963c111e7c',
                     local_repo('hg+http://bitbucket.org/pypa/pip-test-package'),
                     'pip-test-package')
    result = env.run('python', 'setup.py', 'develop',
            cwd=env.scratch_path/'pip-test-package', expect_stderr=True)
    result = run_pip('freeze', expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze
        -- stdout: --------------------
        ...-e %[email protected]#egg=pip_test_package-...
        ...""" % local_checkout('hg+http://bitbucket.org/pypa/pip-test-package'))
    _check_output(result, expected)

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

示例7: test_help_command_should_exit_status_ok_when_command_exists

def test_help_command_should_exit_status_ok_when_command_exists():
    """
    Test `help` command for existing command
    """
    reset_env()
    result = run_pip('help', 'freeze')
    assert result.returncode == SUCCESS
开发者ID:Basis,项目名称:pip,代码行数:7,代码来源:test_help.py

示例8: test_help_command_should_exit_status_ok_when_no_command_is_specified

def test_help_command_should_exit_status_ok_when_no_command_is_specified():
    """
    Test `help` command for no command
    """
    reset_env()
    result = run_pip('help')
    assert result.returncode == SUCCESS
开发者ID:Basis,项目名称:pip,代码行数:7,代码来源:test_help.py

示例9: 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(tests_data, 'packages'))
    run_pip('install', 'paxpkg.tar.bz2', cwd=run_from)
开发者ID:Basis,项目名称:pip,代码行数:7,代码来源:test_install.py

示例10: test_upgrade_vcs_req_with_no_dists_found

def test_upgrade_vcs_req_with_no_dists_found():
    """It can upgrade a VCS requirement that has no distributions otherwise."""
    reset_env()
    req = "%s#egg=pip-test-package" % local_checkout("git+http://github.com/pypa/pip-test-package.git")
    run_pip("install", req)
    result = run_pip("install", "-U", req)
    assert not result.returncode
开发者ID:Basis,项目名称:pip,代码行数:7,代码来源:test_install_upgrade.py

示例11: test_upgrade_vcs_req_with_dist_found

def test_upgrade_vcs_req_with_dist_found():
    """It can upgrade a VCS requirement that has distributions on the index."""
    reset_env()
    # TODO(pnasrat) Using local_checkout fails on windows - oddness with the test path urls/git.
    req = "%s#egg=virtualenv" % "git+git://github.com/pypa/[email protected]"
    run_pip("install", req)
    result = run_pip("install", "-U", req)
    assert not "pypi.python.org" in result.stdout, result.stdout
开发者ID:CLOKER,项目名称:pip,代码行数:8,代码来源:test_install_upgrade.py

示例12: 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:Basis,项目名称:pip,代码行数:8,代码来源:test_completion.py

示例13: 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:Basis,项目名称:pip,代码行数:8,代码来源:test_install.py

示例14: test_missing_argument

def test_missing_argument():
    """
    Test show command with no arguments.

    """
    reset_env()
    result = run_pip('show')
    assert 'ERROR: Please provide a package name or names.' in result.stdout
开发者ID:Basis,项目名称:pip,代码行数:8,代码来源:test_show.py

示例15: test_install_with_hacked_egg_info

def test_install_with_hacked_egg_info():
    """
    test installing a package which defines its own egg_info class
    """
    reset_env()
    run_from = abspath(join(tests_data, 'packages', 'HackedEggInfo'))
    result = run_pip('install', '.', cwd=run_from)
    assert 'Successfully installed hackedegginfo\n' in result.stdout
开发者ID:Basis,项目名称:pip,代码行数:8,代码来源:test_install.py


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