diff --git a/news/c11aae95-1bc6-4a32-b005-65d0a7843207.trivial b/news/c11aae95-1bc6-4a32-b005-65d0a7843207.trivial new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/pip/_internal/req/__init__.py b/src/pip/_internal/req/__init__.py index d2d027adeec..05e08972852 100644 --- a/src/pip/_internal/req/__init__.py +++ b/src/pip/_internal/req/__init__.py @@ -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 diff --git a/src/pip/_internal/req/req_tracker.py b/src/pip/_internal/req/req_tracker.py index 84e0c0419fc..d72a41d203a 100644 --- a/src/pip/_internal/req/req_tracker.py +++ b/src/pip/_internal/req/req_tracker.py @@ -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 diff --git a/tests/functional/test_install_cleanup.py b/tests/functional/test_install_cleanup.py index d9669f74335..1a51d528235 100644 --- a/tests/functional/test_install_cleanup.py +++ b/tests/functional/test_install_cleanup.py @@ -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() diff --git a/tests/functional/test_install_index.py b/tests/functional/test_install_index.py index 5a31db8b482..60f09c5ad7a 100644 --- a/tests/functional/test_install_index.py +++ b/tests/functional/test_install_index.py @@ -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) diff --git a/tests/functional/test_install_reqs.py b/tests/functional/test_install_reqs.py index 2584e09535a..2422bdb500e 100644 --- a/tests/functional/test_install_reqs.py +++ b/tests/functional/test_install_reqs.py @@ -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 diff --git a/tests/functional/test_show.py b/tests/functional/test_show.py index 4cbccc39b54..a4000a20a03 100644 --- a/tests/functional/test_show.py +++ b/tests/functional/test_show.py @@ -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