mirror of https://github.com/pypa/pip
Merge pull request #7614 from deepak1725/string-formatting
Updated string formatting
This commit is contained in:
commit
153e22ae34
|
@ -48,17 +48,18 @@ def install_given_reqs(
|
|||
"""
|
||||
|
||||
if to_install:
|
||||
logger.info(
|
||||
'Installing collected packages: %s',
|
||||
', '.join([req.name for req in to_install]),
|
||||
msg = 'Installing collected packages: {}'.format(
|
||||
', '.join([req.name for req in to_install])
|
||||
)
|
||||
logger.info(msg)
|
||||
|
||||
installed = []
|
||||
|
||||
with indent_log():
|
||||
for requirement in to_install:
|
||||
if requirement.should_reinstall:
|
||||
logger.info('Attempting uninstall: %s', requirement.name)
|
||||
logger.info('Attempting uninstall: {}'.format(
|
||||
requirement.name))
|
||||
with indent_log():
|
||||
uninstalled_pathset = requirement.uninstall(
|
||||
auto_confirm=True
|
||||
|
|
|
@ -60,7 +60,7 @@ def get_requirement_tracker():
|
|||
TempDirectory(kind='req-tracker')
|
||||
).path
|
||||
ctx.enter_context(update_env_context_manager(PIP_REQ_TRACKER=root))
|
||||
logger.debug("Initialized build tracking at %s", root)
|
||||
logger.debug("Initialized build tracking at {}".format(root))
|
||||
|
||||
with RequirementTracker(root) as tracker:
|
||||
yield tracker
|
||||
|
|
|
@ -14,12 +14,14 @@ def test_cleanup_after_install(script, data):
|
|||
Test clean up after installing a package.
|
||||
"""
|
||||
script.pip(
|
||||
'install', '--no-index', '--find-links=%s' % data.find_links, 'simple'
|
||||
'install', '--no-index',
|
||||
'--find-links={}'.format(data.find_links),
|
||||
'simple'
|
||||
)
|
||||
build = script.venv_path / "build"
|
||||
src = script.venv_path / "src"
|
||||
assert not exists(build), "build/ dir still exists: %s" % build
|
||||
assert not exists(src), "unexpected src/ dir exists: %s" % src
|
||||
assert not exists(build), "build/ dir still exists: {}".format(build)
|
||||
assert not exists(src), "unexpected src/ dir exists: {}" .format(src)
|
||||
script.assert_no_temp()
|
||||
|
||||
|
||||
|
@ -31,7 +33,7 @@ def test_no_clean_option_blocks_cleaning_after_install(script, data):
|
|||
build = script.base_path / 'pip-build'
|
||||
script.pip(
|
||||
'install', '--no-clean', '--no-index', '--build', build,
|
||||
'--find-links=%s' % data.find_links, 'simple', expect_temp=True,
|
||||
'--find-links={}'.format(data.find_links), 'simple', expect_temp=True,
|
||||
)
|
||||
assert exists(build)
|
||||
|
||||
|
@ -43,16 +45,14 @@ def test_cleanup_after_install_editable_from_hg(script, tmpdir):
|
|||
Test clean up after cloning from Mercurial.
|
||||
|
||||
"""
|
||||
script.pip(
|
||||
'install',
|
||||
'-e',
|
||||
'%s#egg=ScriptTest' %
|
||||
local_checkout('hg+https://bitbucket.org/ianb/scripttest', tmpdir),
|
||||
requirement = '{}#egg=ScriptTest'.format(
|
||||
local_checkout('hg+https://bitbucket.org/ianb/scripttest', tmpdir)
|
||||
)
|
||||
script.pip('install', '-e', requirement)
|
||||
build = script.venv_path / 'build'
|
||||
src = script.venv_path / 'src'
|
||||
assert not exists(build), "build/ dir still exists: %s" % build
|
||||
assert exists(src), "expected src/ dir doesn't exist: %s" % src
|
||||
assert not exists(build), "build/ dir still exists: {}".format(build)
|
||||
assert exists(src), "expected src/ dir doesn't exist: {}".format(src)
|
||||
script.assert_no_temp()
|
||||
|
||||
|
||||
|
@ -64,8 +64,8 @@ def test_cleanup_after_install_from_local_directory(script, data):
|
|||
script.pip('install', to_install)
|
||||
build = script.venv_path / 'build'
|
||||
src = script.venv_path / 'src'
|
||||
assert not exists(build), "unexpected build/ dir exists: %s" % build
|
||||
assert not exists(src), "unexpected src/ dir exist: %s" % src
|
||||
assert not exists(build), "unexpected build/ dir exists: {}".format(build)
|
||||
assert not exists(src), "unexpected src/ dir exist: {}".format(src)
|
||||
script.assert_no_temp()
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ def test_find_links_relative_path(script, data):
|
|||
cwd=data.root,
|
||||
)
|
||||
egg_info_folder = (
|
||||
script.site_packages / 'parent-0.1-py%s.egg-info' % pyversion
|
||||
script.site_packages / 'parent-0.1-py{}.egg-info'.format(pyversion)
|
||||
)
|
||||
initools_folder = script.site_packages / 'parent'
|
||||
assert egg_info_folder in result.files_created, str(result)
|
||||
|
@ -28,9 +28,9 @@ def test_find_links_requirements_file_relative_path(script, data):
|
|||
"""Test find-links as a relative path to a reqs file."""
|
||||
script.scratch_path.joinpath("test-req.txt").write_text(textwrap.dedent("""
|
||||
--no-index
|
||||
--find-links=%s
|
||||
--find-links={}
|
||||
parent==0.1
|
||||
""" % data.packages.replace(os.path.sep, '/')))
|
||||
""" .format(data.packages.replace(os.path.sep, '/'))))
|
||||
result = script.pip(
|
||||
'install',
|
||||
'-r',
|
||||
|
@ -38,7 +38,7 @@ def test_find_links_requirements_file_relative_path(script, data):
|
|||
cwd=data.root,
|
||||
)
|
||||
egg_info_folder = (
|
||||
script.site_packages / 'parent-0.1-py%s.egg-info' % pyversion
|
||||
script.site_packages / 'parent-0.1-py{}.egg-info'.format(pyversion)
|
||||
)
|
||||
initools_folder = script.site_packages / 'parent'
|
||||
assert egg_info_folder in result.files_created, str(result)
|
||||
|
@ -52,7 +52,7 @@ def test_install_from_file_index_hash_link(script, data):
|
|||
"""
|
||||
result = script.pip('install', '-i', data.index_url(), 'simple==1.0')
|
||||
egg_info_folder = (
|
||||
script.site_packages / 'simple-1.0-py%s.egg-info' % pyversion
|
||||
script.site_packages / 'simple-1.0-py{}.egg-info'.format(pyversion)
|
||||
)
|
||||
assert egg_info_folder in result.files_created, str(result)
|
||||
|
||||
|
@ -69,5 +69,5 @@ def test_file_index_url_quoting(script, data):
|
|||
str(result.stdout)
|
||||
)
|
||||
assert (
|
||||
script.site_packages / 'simple-1.0-py%s.egg-info' % pyversion
|
||||
script.site_packages / 'simple-1.0-py{}.egg-info'.format(pyversion)
|
||||
) in result.files_created, str(result)
|
||||
|
|
|
@ -30,12 +30,13 @@ def test_requirements_file(script):
|
|||
'install', '-r', script.scratch_path / 'initools-req.txt'
|
||||
)
|
||||
assert (
|
||||
script.site_packages / 'INITools-0.2-py%s.egg-info' %
|
||||
pyversion in result.files_created
|
||||
script.site_packages / 'INITools-0.2-py{}.egg-info'.format(
|
||||
pyversion in result.files_created)
|
||||
)
|
||||
assert script.site_packages / 'initools' in result.files_created
|
||||
assert result.files_created[script.site_packages / other_lib_name].dir
|
||||
fn = '%s-%s-py%s.egg-info' % (other_lib_name, other_lib_version, pyversion)
|
||||
fn = '{}-{}-py{}.egg-info'.format(
|
||||
other_lib_name, other_lib_version, pyversion)
|
||||
assert result.files_created[script.site_packages / fn].dir
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ def test_basic_show(script):
|
|||
lines = result.stdout.splitlines()
|
||||
assert len(lines) == 10
|
||||
assert 'Name: pip' in lines
|
||||
assert 'Version: %s' % __version__ in lines
|
||||
assert 'Version: {}'.format(__version__) in lines
|
||||
assert any(line.startswith('Location: ') for line in lines)
|
||||
assert 'Requires: ' in lines
|
||||
|
||||
|
|
Loading…
Reference in New Issue