mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
PreviousBuildDirError logging and test fix
This commit is contained in:
parent
cfb7421e5c
commit
3a1847cd53
|
@ -1053,14 +1053,14 @@ class RequirementSet(object):
|
|||
# Version inconsistencies are logged later, but do not fail the installation.
|
||||
if os.path.exists(os.path.join(location, 'setup.py')):
|
||||
msg = textwrap.dedent("""
|
||||
pip can't install requirement '%s' due to a pre-existing build directory.
|
||||
pip can't proceed with requirement '%s' due to a pre-existing build directory.
|
||||
location: %s
|
||||
This is likely due to a previous installation that failed.
|
||||
pip is being responsible and not assuming it can delete this.
|
||||
Please delete it and try again.
|
||||
""" % (req_to_install, location))
|
||||
e = PreviousBuildDirError(msg)
|
||||
logger.fatal(e)
|
||||
logger.fatal(msg)
|
||||
raise e
|
||||
else:
|
||||
## FIXME: this won't upgrade when there's an existing package unpacked in `location`
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import sys
|
||||
import os
|
||||
import tempfile
|
||||
import shutil
|
||||
|
||||
from pip.exceptions import PreviousBuildDirError
|
||||
from pip.index import PackageFinder
|
||||
from pip.log import logger
|
||||
from pip.req import InstallRequirement, RequirementSet
|
||||
from tests.test_pip import here, path_to_url, assert_raises_regexp
|
||||
|
||||
|
@ -13,9 +15,11 @@ class TestRequirementSet(object):
|
|||
"""RequirementSet tests"""
|
||||
|
||||
def setup(self):
|
||||
logger.consumers = [(logger.NOTIFY, sys.stdout)]
|
||||
self.tempdir = tempfile.mkdtemp()
|
||||
|
||||
def teardown(self):
|
||||
logger.consumers = []
|
||||
shutil.rmtree(self.tempdir, ignore_errors=True)
|
||||
|
||||
def basic_reqset(self):
|
||||
|
@ -38,7 +42,7 @@ class TestRequirementSet(object):
|
|||
finder = PackageFinder([find_links], [])
|
||||
assert_raises_regexp(
|
||||
PreviousBuildDirError,
|
||||
"pip can't install[\s\S]*%s[\s\S]*%s" % (req, build_dir),
|
||||
"pip can't proceed with [\s\S]*%s[\s\S]*%s" % (req, build_dir),
|
||||
reqset.prepare_files,
|
||||
finder
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue