def test_get_egg_cache_paths(): with patch('pkglib.egg_cache.CONFIG', org.OrganisationConfig(installer_search_path=['/usr'])): assert get_egg_cache_paths() == ['/usr'] with patch('pkglib.egg_cache.CONFIG', org.OrganisationConfig(installer_search_path=['/usr', '/bin'])): assert get_egg_cache_paths() == ['/usr', '/bin']
def run(self): """ Wire in the pip uninstall command """ with pip_logging_to_distutils_log(): # Lazy imports here to allow pkglib to bootstrap itself. from pip import req, exceptions rs = req.RequirementSet(build_dir=None, src_dir=None, download_dir=None) for name in self.args: rs.add_requirement(req.InstallRequirement.from_line(name)) install_dir = get_easy_install_cmd(self.distribution).install_dir with patch_UninstallPathSet(get_egg_cache_paths(), install_dir): try: rs.uninstall(auto_confirm=self.yes) except exceptions.UninstallationError as e: distutils.log.fatal(e)