Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'release/1.2.1'

  • Loading branch information...
commit 754bf5ec361cd3584d9695ee8cf1f48641b9ec9d 2 parents 5a691d9 + ac2c3fe
@jezdez jezdez authored
View
7 docs/news.txt
@@ -10,6 +10,13 @@ Next release (1.3) schedule
Beta and final releases planned for the end of 2012.
+1.2.1 (2012-09-06)
+------------------
+
+* Fixed a regression introduced in 1.2 about raising an exception when
+ not finding any files to uninstall in the current environment. Thanks for
+ the fix, Marcus Smith.
+
1.2 (2012-09-01)
----------------
View
4 pip/__init__.py
@@ -11,11 +11,11 @@
from pip.exceptions import InstallationError
from pip.log import logger
from pip.util import get_installed_distributions, get_prog
-from pip.vcs import git, mercurial, subversion, bazaar
+from pip.vcs import git, mercurial, subversion, bazaar # noqa
# The version as used in the setup.py and the docs conf.py
-__version__ = "1.2"
+__version__ = "1.2.1"
def autocomplete():
View
1  pip/basecommand.py
@@ -4,6 +4,7 @@
from pkgutil import walk_packages
import socket
import sys
+import tempfile
import traceback
import time
View
5 pip/req.py
@@ -1463,10 +1463,11 @@ def _stash(self, path):
def remove(self, auto_confirm=False):
"""Remove paths in ``self.paths`` with confirmation (unless
``auto_confirm`` is True)."""
- if not self.paths:
- raise InstallationError("Can't uninstall '%s'. No files were found to uninstall." % self.dist.project_name)
if not self._can_uninstall():
return
+ if not self.paths:
+ logger.notify("Can't uninstall '%s'. No files were found to uninstall." % self.dist.project_name)
+ return
logger.notify('Uninstalling %s:' % self.dist.project_name)
logger.indent += 2
paths = sorted(self.compact(self.paths))
View
12 tests/test_freeze.py
@@ -91,7 +91,7 @@ def test_freeze_git_clone():
expected = textwrap.dedent("""\
Script result: ...pip freeze
-- stdout: --------------------
- -e %s@...#egg=pip_test_package-...
+ ...-e %s@...#egg=pip_test_package-...
...""" % local_checkout('git+http://github.com/pypa/pip-test-package.git'))
_check_output(result, expected)
@@ -101,7 +101,7 @@ def test_freeze_git_clone():
expected = textwrap.dedent("""\
Script result: pip freeze -f %(repo)s#egg=pip_test_package
-- stdout: --------------------
- -f %(repo)s#egg=pip_test_package
+ -f %(repo)s#egg=pip_test_package...
-e %(repo)s@...#egg=pip_test_package-dev
...""" % {'repo': local_checkout('git+http://github.com/pypa/pip-test-package.git')})
_check_output(result, expected)
@@ -124,7 +124,7 @@ def test_freeze_mercurial_clone():
expected = textwrap.dedent("""\
Script result: ...pip freeze
-- stdout: --------------------
- -e %s@...#egg=django_authority-...
+ ...-e %s@...#egg=django_authority-...
...""" % local_checkout('hg+http://bitbucket.org/jezdez/django-authority'))
_check_output(result, expected)
@@ -135,7 +135,7 @@ def test_freeze_mercurial_clone():
Script result: ...pip freeze -f %(repo)s#egg=django_authority
-- stdout: --------------------
-f %(repo)s#egg=django_authority
- -e %(repo)s@...#egg=django_authority-dev
+ ...-e %(repo)s@...#egg=django_authority-dev
...""" % {'repo': local_checkout('hg+http://bitbucket.org/jezdez/django-authority')})
_check_output(result, expected)
@@ -156,7 +156,7 @@ def test_freeze_bazaar_clone():
expected = textwrap.dedent("""\
Script result: ...pip freeze
-- stdout: --------------------
- -e %s@...#egg=django_wikiapp-...
+ ...-e %s@...#egg=django_wikiapp-...
...""" % local_checkout('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1'))
_check_output(result, expected)
@@ -168,7 +168,7 @@ def test_freeze_bazaar_clone():
Script result: ...pip freeze -f %(repo)s/#egg=django-wikiapp
-- stdout: --------------------
-f %(repo)s/#egg=django-wikiapp
- -e %(repo)s@...#egg=django_wikiapp-...
+ ...-e %(repo)s@...#egg=django_wikiapp-...
...""" % {'repo':
local_checkout('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1')})
_check_output(result, expected)
View
34 tests/test_uninstall.py
@@ -2,7 +2,7 @@
import sys
from os.path import join, abspath, normpath
from tempfile import mkdtemp
-from mock import Mock
+from mock import Mock, patch
from nose.tools import assert_raises
from tests.test_pip import here, reset_env, run_pip, assert_all_changes, write_file, pyversion
from tests.local_repos import local_repo, local_checkout
@@ -200,13 +200,35 @@ def test_uninstall_as_egg():
assert_all_changes(result, result2, [env.venv/'build', 'cache'])
-def test_uninstallpathset_no_paths():
+@patch('pip.req.logger')
+def test_uninstallpathset_no_paths(mock_logger):
"""
- Test UninstallPathSet raises installation error when there are no paths (uses mocking)
+ Test UninstallPathSet logs notification when there are no paths to uninstall
"""
from pip.req import UninstallPathSet
from pip.exceptions import InstallationError
- mock_dist = Mock(project_name='pkg')
- uninstall_set = UninstallPathSet(mock_dist)
- assert_raises(InstallationError, uninstall_set.remove)
+ from pkg_resources import get_distribution
+ test_dist = get_distribution('pip')
+ uninstall_set = UninstallPathSet(test_dist)
+ uninstall_set.remove() #with no files added to set
+ mock_logger.notify.assert_any_call("Can't uninstall 'pip'. No files were found to uninstall.")
+
+
+@patch('pip.req.logger')
+def test_uninstallpathset_non_local(mock_logger):
+ """
+ Test UninstallPathSet logs notification and returns (with no exception) when dist is non-local
+
+ """
+ from pip.req import UninstallPathSet
+ from pip.exceptions import InstallationError
+ from pkg_resources import get_distribution
+ test_dist = get_distribution('pip')
+ test_dist.location = '/NON_LOCAL'
+ uninstall_set = UninstallPathSet(test_dist)
+ uninstall_set.remove() #with no files added to set; which is the case when trying to remove non-local dists
+ mock_logger.notify.assert_any_call("Not uninstalling pip at /NON_LOCAL, outside environment %s" % sys.prefix)
+
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.