Skip to content

Commit

Permalink
Fix for pypa#295 install -I when package installed
Browse files Browse the repository at this point in the history
Add simple test and fix to ensure install() runs with -I.

Tests run clean on 2.4, 2.7, 3.2
  • Loading branch information
pnasrat committed Jun 2, 2011
1 parent 48152ad commit 053cda7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pip/req.py
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ def prepare_files(self, finder, force_root_egg_info=False, bundle=False):
# repeat check_if_exists to uninstall-on-upgrade (#14)
req_to_install.check_if_exists()
if req_to_install.satisfied_by:
if self.upgrade:
if self.upgrade or self.ignore_installed:
req_to_install.conflicts_with = req_to_install.satisfied_by
req_to_install.satisfied_by = None
else:
Expand Down
11 changes: 11 additions & 0 deletions tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,14 @@ def test_should_not_install_always_from_cache():
result = run_pip('install', 'INITools==0.1', expect_error=True)
assert env.site_packages/'INITools-0.2-py%s.egg-info' % pyversion not in result.files_created
assert env.site_packages/'INITools-0.1-py%s.egg-info' % pyversion in result.files_created

def test_install_with_ignoreinstalled_requested():
"""
It installs package if ignore installed is set.
"""
env = reset_env()
run_pip('install', 'INITools==0.1', expect_error=True)
result = run_pip('install', '-I' , 'INITools', expect_error=True)
assert result.files_created, 'pip install -I did not install'
assert env.site_packages/'INITools-0.1-py%s.egg-info' % pyversion not in result.files_created

0 comments on commit 053cda7

Please sign in to comment.