Skip to content

Commit

Permalink
feat(): Add logs for pip environment when installing
Browse files Browse the repository at this point in the history
  • Loading branch information
gutsytechster committed May 23, 2020
1 parent db75ac5 commit a0d37a1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions news/3166.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Logs information about pip environment when installing a package.
2 changes: 2 additions & 0 deletions src/pip/_internal/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from pip._internal.utils.misc import (
ensure_dir,
get_installed_version,
get_pip_version,
protect_pip_from_modification_on_windows,
write_output,
)
Expand Down Expand Up @@ -249,6 +250,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,
Expand Down
6 changes: 6 additions & 0 deletions tests/functional/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -1884,3 +1884,9 @@ def test_install_skip_work_dir_pkg(script, data):

assert 'Requirement already satisfied: simple' not in result.stdout
assert 'Successfully installed simple' 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)

0 comments on commit a0d37a1

Please sign in to comment.