Skip to content

Commit 0429aa2

Browse files
committed
Test ensurepip for new flag
1 parent cbd1e15 commit 0429aa2

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

Lib/test/test_ensurepip.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
import ensurepip._uninstall
1313

1414

15+
if sys.implementation.cache_tag is None:
16+
COMPILE_OPT = ["--no-compile"]
17+
else:
18+
COMPILE_OPT = []
19+
20+
1521
class TestPackages(unittest.TestCase):
1622
def touch(self, directory, filename):
1723
fullname = os.path.join(directory, filename)
@@ -85,7 +91,7 @@ def test_basic_bootstrapping(self):
8591
self.run_pip.assert_called_once_with(
8692
[
8793
"install", "--no-cache-dir", "--no-index", "--find-links",
88-
unittest.mock.ANY, "pip",
94+
unittest.mock.ANY, *COMPILE_OPT, "pip",
8995
],
9096
unittest.mock.ANY,
9197
)
@@ -99,7 +105,7 @@ def test_bootstrapping_with_root(self):
99105
self.run_pip.assert_called_once_with(
100106
[
101107
"install", "--no-cache-dir", "--no-index", "--find-links",
102-
unittest.mock.ANY, "--root", "/foo/bar/",
108+
unittest.mock.ANY, "--root", "/foo/bar/", *COMPILE_OPT,
103109
"pip",
104110
],
105111
unittest.mock.ANY,
@@ -111,7 +117,7 @@ def test_bootstrapping_with_user(self):
111117
self.run_pip.assert_called_once_with(
112118
[
113119
"install", "--no-cache-dir", "--no-index", "--find-links",
114-
unittest.mock.ANY, "--user", "pip",
120+
unittest.mock.ANY, "--user", *COMPILE_OPT, "pip",
115121
],
116122
unittest.mock.ANY,
117123
)
@@ -122,7 +128,7 @@ def test_bootstrapping_with_upgrade(self):
122128
self.run_pip.assert_called_once_with(
123129
[
124130
"install", "--no-cache-dir", "--no-index", "--find-links",
125-
unittest.mock.ANY, "--upgrade", "pip",
131+
unittest.mock.ANY, "--upgrade", *COMPILE_OPT, "pip",
126132
],
127133
unittest.mock.ANY,
128134
)
@@ -133,7 +139,7 @@ def test_bootstrapping_with_verbosity_1(self):
133139
self.run_pip.assert_called_once_with(
134140
[
135141
"install", "--no-cache-dir", "--no-index", "--find-links",
136-
unittest.mock.ANY, "-v", "pip",
142+
unittest.mock.ANY, "-v", *COMPILE_OPT, "pip",
137143
],
138144
unittest.mock.ANY,
139145
)
@@ -144,7 +150,7 @@ def test_bootstrapping_with_verbosity_2(self):
144150
self.run_pip.assert_called_once_with(
145151
[
146152
"install", "--no-cache-dir", "--no-index", "--find-links",
147-
unittest.mock.ANY, "-vv", "pip",
153+
unittest.mock.ANY, "-vv", *COMPILE_OPT, "pip",
148154
],
149155
unittest.mock.ANY,
150156
)
@@ -155,7 +161,7 @@ def test_bootstrapping_with_verbosity_3(self):
155161
self.run_pip.assert_called_once_with(
156162
[
157163
"install", "--no-cache-dir", "--no-index", "--find-links",
158-
unittest.mock.ANY, "-vvv", "pip",
164+
unittest.mock.ANY, "-vvv", *COMPILE_OPT, "pip",
159165
],
160166
unittest.mock.ANY,
161167
)
@@ -312,7 +318,7 @@ def test_basic_bootstrapping(self):
312318
self.run_pip.assert_called_once_with(
313319
[
314320
"install", "--no-cache-dir", "--no-index", "--find-links",
315-
unittest.mock.ANY, "pip",
321+
unittest.mock.ANY, *COMPILE_OPT, "pip",
316322
],
317323
unittest.mock.ANY,
318324
)

0 commit comments

Comments
 (0)