diff options
author | Jannis Leidel <jannis@leidel.info> | 2012-09-06 10:30:49 +0200 |
---|---|---|
committer | Jannis Leidel <jannis@leidel.info> | 2012-09-06 10:30:49 +0200 |
commit | 754bf5ec361cd3584d9695ee8cf1f48641b9ec9d (patch) | |
tree | d715fd52c287a1ca4cb537320ef5d3f47b9352f9 | |
parent | 5a691d94cc3d98f43dadc2519feb71ea9f048206 (diff) | |
parent | ac2c3fed396373b49bccd75d683eeb1406981918 (diff) | |
download | pip-754bf5ec361cd3584d9695ee8cf1f48641b9ec9d.tar.gz |
Merge branch 'release/1.2.1'1.2.1
-rw-r--r-- | docs/news.txt | 7 | ||||
-rwxr-xr-x | pip/__init__.py | 4 | ||||
-rw-r--r-- | pip/basecommand.py | 1 | ||||
-rw-r--r-- | pip/req.py | 5 | ||||
-rw-r--r-- | tests/test_freeze.py | 12 | ||||
-rw-r--r-- | tests/test_uninstall.py | 34 |
6 files changed, 47 insertions, 16 deletions
diff --git a/docs/news.txt b/docs/news.txt index 194754c2a..ace21bc6b 100644 --- a/docs/news.txt +++ b/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) ---------------- diff --git a/pip/__init__.py b/pip/__init__.py index f094a1d4d..7b4f66330 100755 --- a/pip/__init__.py +++ b/pip/__init__.py @@ -11,11 +11,11 @@ from pip.baseparser import parser 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(): diff --git a/pip/basecommand.py b/pip/basecommand.py index 2cea2f714..a4eece92b 100644 --- a/pip/basecommand.py +++ b/pip/basecommand.py @@ -4,6 +4,7 @@ import os from pkgutil import walk_packages import socket import sys +import tempfile import traceback import time diff --git a/pip/req.py b/pip/req.py index 98665f869..57141150d 100644 --- a/pip/req.py +++ b/pip/req.py @@ -1463,10 +1463,11 @@ class UninstallPathSet(object): 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)) diff --git a/tests/test_freeze.py b/tests/test_freeze.py index 4412c1435..7e2a8b3ea 100644 --- a/tests/test_freeze.py +++ b/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) diff --git a/tests/test_uninstall.py b/tests/test_uninstall.py index 28339a615..7a81960ef 100644 --- a/tests/test_uninstall.py +++ b/tests/test_uninstall.py @@ -2,7 +2,7 @@ import textwrap 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) + + + |