Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 71a8589

Browse files
committed
Closes python#24267 - Does not check version on ensurepip uninstall
Ensure that the uninstall helper for Windows passes the proper flags to pip to prevent it from checking PyPI if the pip that we're currently attempting to uninstall is the latest verison.
1 parent 11cf4f6 commit 71a8589

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

Lib/ensurepip/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def _uninstall_helper(*, verbosity=0):
137137
_disable_pip_configuration_settings()
138138

139139
# Construct the arguments to be passed to the pip command
140-
args = ["uninstall", "-y"]
140+
args = ["uninstall", "-y", "--disable-pip-version-check"]
141141
if verbosity:
142142
args += ["-" + "v" * verbosity]
143143

Lib/test/test_ensurepip.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,10 @@ def test_uninstall(self):
211211
ensurepip._uninstall_helper()
212212

213213
self.run_pip.assert_called_once_with(
214-
["uninstall", "-y", "pip", "setuptools"]
214+
[
215+
"uninstall", "-y", "--disable-pip-version-check", "pip",
216+
"setuptools",
217+
]
215218
)
216219

217220
@requires_usable_pip
@@ -220,7 +223,10 @@ def test_uninstall_with_verbosity_1(self):
220223
ensurepip._uninstall_helper(verbosity=1)
221224

222225
self.run_pip.assert_called_once_with(
223-
["uninstall", "-y", "-v", "pip", "setuptools"]
226+
[
227+
"uninstall", "-y", "--disable-pip-version-check", "-v", "pip",
228+
"setuptools",
229+
]
224230
)
225231

226232
@requires_usable_pip
@@ -229,7 +235,10 @@ def test_uninstall_with_verbosity_2(self):
229235
ensurepip._uninstall_helper(verbosity=2)
230236

231237
self.run_pip.assert_called_once_with(
232-
["uninstall", "-y", "-vv", "pip", "setuptools"]
238+
[
239+
"uninstall", "-y", "--disable-pip-version-check", "-vv", "pip",
240+
"setuptools",
241+
]
233242
)
234243

235244
@requires_usable_pip
@@ -238,7 +247,10 @@ def test_uninstall_with_verbosity_3(self):
238247
ensurepip._uninstall_helper(verbosity=3)
239248

240249
self.run_pip.assert_called_once_with(
241-
["uninstall", "-y", "-vvv", "pip", "setuptools"]
250+
[
251+
"uninstall", "-y", "--disable-pip-version-check", "-vvv",
252+
"pip", "setuptools",
253+
]
242254
)
243255

244256
@requires_usable_pip
@@ -336,7 +348,10 @@ def test_basic_uninstall(self):
336348
ensurepip._uninstall._main([])
337349

338350
self.run_pip.assert_called_once_with(
339-
["uninstall", "-y", "pip", "setuptools"]
351+
[
352+
"uninstall", "-y", "--disable-pip-version-check", "pip",
353+
"setuptools",
354+
]
340355
)
341356

342357

0 commit comments

Comments
 (0)