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

Python test_pip.assert_all_changes函数代码示例

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

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



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

示例1: _test_uninstall_editable_with_source_outside_venv

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


示例2: _test_uninstall_editable_with_source_outside_venv

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


示例3: test_upgrade_from_reqs_file

def test_upgrade_from_reqs_file():
    """
    Upgrade from a requirements file.

    """
    env = reset_env()
    write_file(
        "test-req.txt",
        textwrap.dedent(
            """\
        PyLogo<0.4
        # and something else to test out:
        INITools==0.3
        """
        ),
    )
    install_result = run_pip("install", "-r", env.scratch_path / "test-req.txt")
    write_file(
        "test-req.txt",
        textwrap.dedent(
            """\
        PyLogo
        # and something else to test out:
        INITools
        """
        ),
    )
    run_pip("install", "--upgrade", "-r", env.scratch_path / "test-req.txt")
    uninstall_result = run_pip("uninstall", "-r", env.scratch_path / "test-req.txt", "-y")
    assert_all_changes(install_result, uninstall_result, [env.venv / "build", "cache", env.scratch / "test-req.txt"])
开发者ID:none-da,项目名称:pip,代码行数:30,代码来源:test_upgrade.py


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


示例5: test_uninstall_overlapping_package

def test_uninstall_overlapping_package():
    """
    Uninstalling a distribution that adds modules to a pre-existing package
    should only remove those added modules, not the rest of the existing
    package.

    See: GitHub issue #355 (pip uninstall removes things it didn't install)
    """
    parent_pkg = abspath(join(here, 'packages', 'parent-0.1.tar.gz'))
    child_pkg = abspath(join(here, 'packages', 'child-0.1.tar.gz'))
    env = reset_env()
    result1 = run_pip('install', parent_pkg, expect_error=False)
    assert join(env.site_packages, 'parent') in result1.files_created, sorted(result1.files_created.keys())
    result2 = run_pip('install', child_pkg, expect_error=False)
    assert join(env.site_packages, 'child') in result2.files_created, sorted(result2.files_created.keys())
    assert normpath(join(env.site_packages, 'parent/plugins/child_plugin.py')) in result2.files_created, sorted(result2.files_created.keys())
    #the import forces the generation of __pycache__ if the version of python supports it
    env.run('python', '-c', "import parent.plugins.child_plugin, child")
    result3 = run_pip('uninstall', '-y', 'child', expect_error=False)
    assert join(env.site_packages, 'child') in result3.files_deleted, sorted(result3.files_created.keys())
    assert normpath(join(env.site_packages, 'parent/plugins/child_plugin.py')) in result3.files_deleted, sorted(result3.files_deleted.keys())
    assert join(env.site_packages, 'parent') not in result3.files_deleted, sorted(result3.files_deleted.keys())
    # Additional check: uninstalling 'child' should return things to the
    # previous state, without unintended side effects.
    assert_all_changes(result2, result3, [])
开发者ID:AndreaCrotti,项目名称:pip,代码行数:25,代码来源:test_uninstall.py


示例6: test_uninstall_from_usersite

 def test_uninstall_from_usersite(self):
     """
     Test uninstall from usersite
     """
     env = reset_env(system_site_packages=True)
     result1 = run_pip('install', '--user', 'INITools==0.3')
     result2 = run_pip('uninstall', '-y', 'INITools')
     assert_all_changes(result1, result2, [env.venv/'build', 'cache'])
开发者ID:OldBao,项目名称:pip,代码行数:8,代码来源:test_user_site.py


示例7: 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:B-Rich,项目名称:heroku-buildpack-python,代码行数:10,代码来源:test_uninstall.py


示例8: 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:none-da,项目名称:pip,代码行数:10,代码来源:test_uninstall.py


示例9: test_uninstall_easy_install_after_import

def test_uninstall_easy_install_after_import():
    """
    Uninstall an easy_installed package after it's been imported

    """
    env = reset_env()
    result = env.run('easy_install', 'INITools==0.2', expect_stderr=True)
    #the import forces the generation of __pycache__ if the version of python supports it
    env.run('python', '-c', "import initools")
    result2 = run_pip('uninstall', 'INITools', '-y')
    assert_all_changes(result, result2, [env.venv/'build', 'cache'])
开发者ID:AndreaCrotti,项目名称:pip,代码行数:11,代码来源:test_uninstall.py


示例10: test_uninstall_easy_install_after_import

def test_uninstall_easy_install_after_import():
    """
    Uninstall an easy_installed package after it's been imported

    """
    env = reset_env()
    result = env.run("easy_install", "INITools==0.2", expect_stderr=True)
    # the import forces the generation of __pycache__ if the version of python supports it
    env.run("python", "-c", "import initools")
    result2 = run_pip("uninstall", "INITools", "-y")
    assert_all_changes(result, result2, [env.venv / "build", "cache"])
开发者ID:rafaelcaricio,项目名称:pip,代码行数:11,代码来源:test_uninstall.py


示例11: test_simple_uninstall

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

    """
    env = reset_env()
    result = run_pip("install", "INITools==0.2")
    assert join(env.site_packages, "initools") in result.files_created, sorted(result.files_created.keys())
    # the import forces the generation of __pycache__ if the version of python supports it
    env.run("python", "-c", "import initools")
    result2 = run_pip("uninstall", "INITools", "-y")
    assert_all_changes(result, result2, [env.venv / "build", "cache"])
开发者ID:rafaelcaricio,项目名称:pip,代码行数:12,代码来源:test_uninstall.py


示例12: test_uninstall_easy_installed_console_scripts

def test_uninstall_easy_installed_console_scripts():
    """
    Test uninstalling package with console_scripts that is easy_installed.

    """
    env = reset_env()
    args = ["easy_install"]
    args.append("discover")
    result = env.run(*args, **{"expect_stderr": True})
    assert env.bin / "discover" + env.exe in result.files_created, sorted(result.files_created.keys())
    result2 = run_pip("uninstall", "discover", "-y")
    assert_all_changes(result, result2, [env.venv / "build", "cache"])
开发者ID:rafaelcaricio,项目名称:pip,代码行数:12,代码来源:test_uninstall.py


示例13: test_uninstall_before_upgrade_from_url

def test_uninstall_before_upgrade_from_url():
    """
    Automatic uninstall-before-upgrade from URL.

    """
    env = reset_env()
    result = run_pip('install', 'INITools==0.2', expect_error=True)
    assert env.site_packages/ 'initools' in result.files_created, sorted(result.files_created.keys())
    result2 = run_pip('install', 'http://pypi.python.org/packages/source/I/INITools/INITools-0.3.tar.gz', expect_error=True)
    assert result2.files_created, 'upgrade to INITools 0.3 failed'
    result3 = run_pip('uninstall', 'initools', '-y', expect_error=True)
    assert_all_changes(result, result3, [env.venv/'build', 'cache'])
开发者ID:AndreaCrotti,项目名称:pip,代码行数:12,代码来源:test_upgrade.py


示例14: test_uninstall_before_upgrade

def test_uninstall_before_upgrade():
    """
    Automatic uninstall-before-upgrade.

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


示例15: test_uninstall_before_upgrade

def test_uninstall_before_upgrade():
    """
    Automatic uninstall-before-upgrade.

    """
    env = reset_env()
    result = run_pip("install", "INITools==0.2", expect_error=True)
    assert env.site_packages / "initools" in result.files_created, sorted(result.files_created.keys())
    result2 = run_pip("install", "INITools==0.3", expect_error=True)
    assert result2.files_created, "upgrade to INITools 0.3 failed"
    result3 = run_pip("uninstall", "initools", "-y", expect_error=True)
    assert_all_changes(result, result3, [env.venv / "build", "cache"])
开发者ID:none-da,项目名称:pip,代码行数:12,代码来源:test_upgrade.py


示例16: 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()
    args = ['install']
    args.append('discover')
    result = run_pip(*args, **{"expect_error": True})
    assert env.bin/'discover'+env.exe in result.files_created, sorted(result.files_created.keys())
    result2 = run_pip('uninstall', 'discover', '-y', expect_error=True)
    assert_all_changes(result, result2, [env.venv/'build', 'cache'])
开发者ID:AndreaCrotti,项目名称:pip,代码行数:12,代码来源:test_uninstall.py


示例17: test_uninstall_with_scripts

def test_uninstall_with_scripts():
    """
    Uninstall an easy_installed package with scripts.

    """
    env = reset_env()
    result = env.run("easy_install", "PyLogo", expect_stderr=True)
    easy_install_pth = env.site_packages / "easy-install.pth"
    pylogo = sys.platform == "win32" and "pylogo" or "PyLogo"
    assert pylogo in result.files_updated[easy_install_pth].bytes
    result2 = run_pip("uninstall", "pylogo", "-y", expect_error=True)
    assert_all_changes(result, result2, [env.venv / "build", "cache"])
开发者ID:rafaelcaricio,项目名称:pip,代码行数:12,代码来源:test_uninstall.py


示例18: 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', '%s#egg=initools-dev' %
                     local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'))
    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:AndreaCrotti,项目名称:pip,代码行数:12,代码来源:test_uninstall.py


示例19: test_uninstall_with_scripts

def test_uninstall_with_scripts():
    """
    Uninstall an easy_installed package with scripts.

    """
    env = reset_env()
    result = env.run('easy_install', 'PyLogo', expect_stderr=True)
    easy_install_pth = env.site_packages/ 'easy-install.pth'
    pylogo = sys.platform == 'win32' and 'pylogo' or 'PyLogo'
    assert(pylogo in result.files_updated[easy_install_pth].bytes)
    result2 = run_pip('uninstall', 'pylogo', '-y', expect_error=True)
    assert_all_changes(result, result2, [env.venv/'build', 'cache'])
开发者ID:AndreaCrotti,项目名称:pip,代码行数:12,代码来源:test_uninstall.py


示例20: test_simple_uninstall

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

    """
    env = reset_env()
    result = run_pip('install', 'INITools==0.2')
    assert join(env.site_packages, 'initools') in result.files_created, sorted(result.files_created.keys())
    #the import forces the generation of __pycache__ if the version of python supports it
    env.run('python', '-c', "import initools")
    result2 = run_pip('uninstall', 'INITools', '-y')
    assert_all_changes(result, result2, [env.venv/'build', 'cache'])
开发者ID:AndreaCrotti,项目名称:pip,代码行数:12,代码来源:test_uninstall.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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