本文整理汇总了Python中tests.test_pip.assert_all_changes函数的典型用法代码示例。如果您正苦于以下问题:Python assert_all_changes函数的具体用法?Python assert_all_changes怎么用?Python assert_all_changes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_all_changes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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"])
示例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'])
示例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"])
示例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'])
示例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, [])
示例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'])
示例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'])
示例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"])
示例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'])
示例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"])
示例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"])
示例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"])
示例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'])
示例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'])
示例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"])