mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
fix test for no paths in uninstall set
This commit is contained in:
parent
99e28f072b
commit
ab335810d2
1 changed files with 10 additions and 6 deletions
|
@ -2,7 +2,7 @@ import textwrap
|
||||||
import sys
|
import sys
|
||||||
from os.path import join, abspath, normpath
|
from os.path import join, abspath, normpath
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
from mock import Mock
|
from mock import Mock, patch
|
||||||
from nose.tools import assert_raises
|
from nose.tools import assert_raises
|
||||||
from tests.test_pip import here, reset_env, run_pip, assert_all_changes, write_file, pyversion
|
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
|
from tests.local_repos import local_repo, local_checkout
|
||||||
|
@ -200,13 +200,17 @@ def test_uninstall_as_egg():
|
||||||
assert_all_changes(result, result2, [env.venv/'build', 'cache'])
|
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 warning when there are no paths to uninstall
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from pip.req import UninstallPathSet
|
from pip.req import UninstallPathSet
|
||||||
from pip.exceptions import InstallationError
|
from pip.exceptions import InstallationError
|
||||||
mock_dist = Mock(project_name='pkg')
|
from pkg_resources import get_distribution
|
||||||
uninstall_set = UninstallPathSet(mock_dist)
|
test_dist = get_distribution('pip')
|
||||||
assert_raises(InstallationError, uninstall_set.remove)
|
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.")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue