From 0ccbad8367df8f82dfaf27d9187f6df61868ec0a Mon Sep 17 00:00:00 2001 From: gutsytechster Date: Mon, 18 May 2020 20:01:06 +0530 Subject: [PATCH 1/3] feat(): Add logs for pip environment when installing --- news/3166.feature | 1 + src/pip/_internal/commands/install.py | 2 ++ tests/functional/test_install.py | 6 ++++++ 3 files changed, 9 insertions(+) create mode 100644 news/3166.feature diff --git a/news/3166.feature b/news/3166.feature new file mode 100644 index 00000000000..8abc2560cb6 --- /dev/null +++ b/news/3166.feature @@ -0,0 +1 @@ +Logs information about pip environment when installing a package. diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py index 54e998370bb..a155b944eca 100644 --- a/src/pip/_internal/commands/install.py +++ b/src/pip/_internal/commands/install.py @@ -27,6 +27,7 @@ from pip._internal.utils.misc import ( ensure_dir, get_installed_version, + get_pip_version, protect_pip_from_modification_on_windows, write_output, ) @@ -239,6 +240,7 @@ def run(self, options, args): install_options = options.install_options or [] + logger.debug("Using {}".format(get_pip_version())) options.use_user_site = decide_user_install( options.use_user_site, prefix_path=options.prefix_path, diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py index 2cff6ca2229..c4ceb03d352 100644 --- a/tests/functional/test_install.py +++ b/tests/functional/test_install.py @@ -1902,3 +1902,9 @@ def test_install_verify_package_name_normalization(script, package_name): result = script.pip('install', package_name) assert 'Requirement already satisfied: {}'.format( package_name) in result.stdout + + +def test_install_logs_pip_version_in_debug(script): + result = script.pip('install', '-v', 'INITools==0.2') + pattern = "Using pip .* from .*" + assert_re_match(pattern, result.stdout) From 277b1e6c30fac469860b459248f7ce0d121aa68a Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Sun, 31 May 2020 23:00:32 +0530 Subject: [PATCH 2/3] Update news/3166.feature --- news/3166.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/3166.feature b/news/3166.feature index 8abc2560cb6..1d8e049ffe8 100644 --- a/news/3166.feature +++ b/news/3166.feature @@ -1 +1 @@ -Logs information about pip environment when installing a package. +Log debugging information about pip, in ``pip install --verbose``. From f7abe1f874406c205c6f5a026a9b6ad28756d040 Mon Sep 17 00:00:00 2001 From: Prashant Sharma Date: Fri, 10 Jul 2020 16:20:30 +0530 Subject: [PATCH 3/3] test(functional/test_install): Use shared_data for installing package --- tests/functional/test_install.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py index c4ceb03d352..51c8dab4a6e 100644 --- a/tests/functional/test_install.py +++ b/tests/functional/test_install.py @@ -1904,7 +1904,8 @@ def test_install_verify_package_name_normalization(script, package_name): package_name) in result.stdout -def test_install_logs_pip_version_in_debug(script): - result = script.pip('install', '-v', 'INITools==0.2') +def test_install_logs_pip_version_in_debug(script, shared_data): + fake_package = shared_data.packages / 'simple-2.0.tar.gz' + result = script.pip('install', '-v', fake_package) pattern = "Using pip .* from .*" assert_re_match(pattern, result.stdout)