1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00
pip/tests/functional/test_check.py
Wilfred Hughes 76c356151a Add a pip check command.
This command ensures that all packages installed have all the
requirements they need, and that requirements have compatible
versions. This is useful because pip can install incompatible
dependencies[1], or a user may have manually (un)installed a
package.

[1] https://github.com/pypa/pip/issues/775
2015-03-07 22:02:47 -08:00

52 lines
1.7 KiB
Python

def test_check_clean(script):
"""On a clean environment, check shouldn't return anything.
"""
result = script.pip('check')
assert result.stdout == ""
def test_check_missing_dependency(script):
# this will also install ipython, a dependency
script.pip('install', 'ipdb==0.7')
# deliberately remove the dependency
script.pip('uninstall', 'ipython', '--yes')
result = script.pip('check', expect_error=True)
assert result.stdout == ("ipdb 0.7 requires ipython, "
"which is not installed.\n")
assert result.returncode == 1
def test_check_missing_dependency_normalize_case(script):
# Install some things
script.pip('install', 'devpi-web==2.2.2')
script.pip('install', 'pyramid==1.5.2')
# deliberately remove some dependencies
script.pip('uninstall', 'pygments', '--yes')
script.pip('uninstall', 'zope.deprecation', '--yes')
result = script.pip('check', expect_error=True)
assert ('devpi-web 2.2.2 requires pygments, '
'which is not installed.') in result.stdout
assert ('pyramid 1.5.2 requires zope.deprecation, '
'which is not installed.') in result.stdout
assert result.returncode == 1
def test_check_broken_dependency(script):
# this will also install a compatible version of jinja2
script.pip('install', 'flask==0.10.1')
# deliberately change dependency to a version that is too old
script.pip('install', 'jinja2==2.3')
result = script.pip('check', expect_error=True)
assert result.stdout == ("Flask 0.10.1 has requirement Jinja2>=2.4, "
"but you have Jinja2 2.3.\n")
assert result.returncode == 1