Skip to content

Commit

Permalink
Merge pull request #7614 from deepak1725/string-formatting
Browse files Browse the repository at this point in the history
Updated string formatting
  • Loading branch information
chrahunt authored Jan 25, 2020
2 parents 87fa5ce + b242c39 commit 153e22a
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 28 deletions.
Empty file.
9 changes: 5 additions & 4 deletions src/pip/_internal/req/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/req/req_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 13 additions & 13 deletions tests/functional/test_install_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand All @@ -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)

Expand All @@ -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()


Expand All @@ -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()


Expand Down
12 changes: 6 additions & 6 deletions tests/functional/test_install_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -28,17 +28,17 @@ 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',
script.scratch_path / "test-req.txt",
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)
Expand All @@ -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)

Expand All @@ -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)
7 changes: 4 additions & 3 deletions tests/functional/test_install_reqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 153e22a

Please sign in to comment.