File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed
src/pip/_internal/commands Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change
1
+ Suggest checking "pip config debug" in case of an InvalidProxyURL error.
Original file line number Diff line number Diff line change 8
8
from typing import List , Optional
9
9
10
10
from pip ._vendor .packaging .utils import canonicalize_name
11
+ from pip ._vendor .requests .exceptions import InvalidProxyURL
11
12
from pip ._vendor .rich import print_json
12
13
13
14
# Eagerly import self_outdated_check to avoid crashes. Otherwise,
@@ -766,6 +767,13 @@ def create_os_error_message(
766
767
parts .append (permissions_part )
767
768
parts .append (".\n " )
768
769
770
+ # Suggest to check "pip config debug" in case of invalid proxy
771
+ if type (error ) is InvalidProxyURL :
772
+ parts .append (
773
+ 'Consider checking your local proxy configuration with "pip config debug"'
774
+ )
775
+ parts .append (".\n " )
776
+
769
777
# Suggest the user to enable Long Paths if path length is
770
778
# more than 260
771
779
if (
Original file line number Diff line number Diff line change 3
3
4
4
import pytest
5
5
6
+ from pip ._vendor .requests .exceptions import InvalidProxyURL
7
+
6
8
from pip ._internal .commands import install
7
9
from pip ._internal .commands .install import create_os_error_message , decide_user_install
8
10
@@ -108,6 +110,16 @@ def test_most_cases(
108
110
" file permission\n Consider using the `--user` option or check the"
109
111
" permissions.\n " ,
110
112
),
113
+ # Testing custom InvalidProxyURL with help message
114
+ # show_traceback = True, using_user_site = True
115
+ (
116
+ InvalidProxyURL (),
117
+ True ,
118
+ True ,
119
+ "Could not install packages due to an OSError.\n "
120
+ "Consider checking your local proxy configuration"
121
+ ' with "pip config debug".\n ' ,
122
+ ),
111
123
],
112
124
)
113
125
def test_create_os_error_message (
You can’t perform that action at this time.
0 commit comments