Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check command #1

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pip/commands/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def setup_logging(self):
def run(self, options, args):
all_requirements_met = True

installed = get_installed_distributions()
installed = get_installed_distributions(skip=())
for dist in installed:

missing_requirements = self.get_missing_requirements(dist, installed)
Expand All @@ -41,11 +41,11 @@ def get_missing_requirements(self, dist, installed_dists):
`installed_dists`.

"""
installed_names = set(d.project_name for d in installed_dists)
installed_names = set(d.project_name.lower() for d in installed_dists)

missing_requirements = set()
for requirement in dist.requires():
if requirement.project_name not in installed_names:
if requirement.project_name.lower() not in installed_names:
missing_requirements.add(requirement)
yield requirement

Expand Down
24 changes: 22 additions & 2 deletions tests/functional/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,40 @@ def test_check_missing_dependency(script):

# deliberately remove the dependency
script.pip('uninstall', 'ipython', '--yes')

result = script.pip('check', expect_error=True, expect_stderr=True)

assert result.stderr == "ipdb 0.7 requires ipython, which is not installed.\n"
assert result.returncode == 1


def test_check_missing_dependency_normalize_case(script):
# this will also install ipython, a dependency
script.pip('install', 'pdbpp==0.7.2')
script.pip('install', 'bpython==0.13.1')
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, expect_stderr=True)

assert 'pdbpp 0.7.2 requires pygments, which is not installed.' in result.stdout
assert 'bpython 0.13.1 requires pygments, which is not installed.' in result.stdout
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, expect_stderr=True)

assert result.stderr == "Flask 0.10.1 has requirement Jinja2>=2.4, but you have Jinja2 2.3.\n"
Expand Down