diff --git a/news/7390.trivial.rst b/news/7390.trivial.rst new file mode 100644 index 00000000000..788c67a7293 --- /dev/null +++ b/news/7390.trivial.rst @@ -0,0 +1 @@ +Enhance the log message while downloading a pip file \ No newline at end of file diff --git a/src/pip/_internal/network/download.py b/src/pip/_internal/network/download.py index 47af547d6fc..1fa9f857ccb 100644 --- a/src/pip/_internal/network/download.py +++ b/src/pip/_internal/network/download.py @@ -10,7 +10,6 @@ from pip._internal.cli.progress_bars import DownloadProgressProvider from pip._internal.exceptions import NetworkConnectionError -from pip._internal.models.index import PyPI from pip._internal.models.link import Link from pip._internal.network.cache import is_from_cache from pip._internal.network.session import PipSession @@ -34,11 +33,7 @@ def _prepare_download( ) -> Iterable[bytes]: total_length = _get_http_response_size(resp) - if link.netloc == PyPI.file_storage_domain: - url = link.show_url - else: - url = link.url_without_fragment - + url = link.show_url logged_url = redact_auth_from_url(url) if total_length: diff --git a/tests/unit/test_network_download.py b/tests/unit/test_network_download.py index 20f5513a2df..357bb0b2a66 100644 --- a/tests/unit/test_network_download.py +++ b/tests/unit/test_network_download.py @@ -14,17 +14,17 @@ @pytest.mark.parametrize("url, headers, from_cache, expected", [ ('http://example.com/foo.tgz', {}, False, - "Downloading http://example.com/foo.tgz"), + "Downloading foo.tgz"), ('http://example.com/foo.tgz', {'content-length': 2}, False, - "Downloading http://example.com/foo.tgz (2 bytes)"), + "Downloading foo.tgz (2 bytes)"), ('http://example.com/foo.tgz', {'content-length': 2}, True, - "Using cached http://example.com/foo.tgz (2 bytes)"), + "Using cached foo.tgz (2 bytes)"), ('https://files.pythonhosted.org/foo.tgz', {}, False, "Downloading foo.tgz"), ('https://files.pythonhosted.org/foo.tgz', {'content-length': 2}, False, "Downloading foo.tgz (2 bytes)"), ('https://files.pythonhosted.org/foo.tgz', {'content-length': 2}, True, - "Using cached foo.tgz"), + "Using cached foo.tgz (2 bytes)"), ]) def test_prepare_download__log(caplog, url, headers, from_cache, expected): caplog.set_level(logging.INFO)