@@ -167,6 +167,8 @@ def test_download_specify_platform(script, data):
167
167
Test using "pip download --platform" to download a .whl archive
168
168
supported for a specific platform
169
169
"""
170
+ # Confirm that universal wheels are returned even for specific
171
+ # platforms.
170
172
result = script .pip (
171
173
'download' , '--no-index' , '--find-links' , data .find_links ,
172
174
'--dest' , '.' , '--platform' , 'linux_x86_64' , 'simplewheel'
@@ -186,15 +188,49 @@ def test_download_specify_platform(script, data):
186
188
in result .files_created
187
189
)
188
190
191
+ # Now confirm that platform specific wheels will also be fetched.
192
+ result = script .pip (
193
+ 'download' , '--no-index' , '--find-links' , data .find_links ,
194
+ '--dest' , '.' , '--platform' , 'macosx_10_10_x86_64' , 'simpleplatdist==1.0'
195
+ )
196
+ assert (
197
+ Path ('scratch' ) / 'simpleplatdist-1.0-cp27-none-macosx_10_9_x86_64.whl'
198
+ in result .files_created
199
+ )
200
+
201
+ # OSX platform wheels are not forward-compatible.
202
+ result = script .pip (
203
+ 'download' , '--no-index' , '--find-links' , data .find_links ,
204
+ '--dest' , '.' , '--platform' , 'macosx_10_8_x86_64' , 'simpleplatdist==1.0' ,
205
+ expect_error = True ,
206
+ )
207
+
208
+ # No linux wheel provided for this version.
209
+ result = script .pip (
210
+ 'download' , '--no-index' , '--find-links' , data .find_links ,
211
+ '--dest' , '.' , '--platform' , 'linux_x86_64' , 'simpleplatdist==1.0' ,
212
+ expect_error = True ,
213
+ )
214
+
215
+ result = script .pip (
216
+ 'download' , '--no-index' , '--find-links' , data .find_links ,
217
+ '--dest' , '.' , '--platform' , 'linux_x86_64' , 'simpleplatdist==2.0'
218
+ )
219
+ assert (
220
+ Path ('scratch' ) / 'simpleplatdist-2.0-py2.py3-none-any.whl'
221
+ in result .files_created
222
+ )
223
+
224
+
189
225
@pytest .mark .network
190
226
def test_download_specify_interpreter_version (script , data ):
191
227
"""
192
228
Test using "pip download --interpreter-version" to download a .whl archive
193
- supported for a specific platform
229
+ supported for a specific interpreter
194
230
"""
195
231
result = script .pip (
196
232
'download' , '--no-index' , '--find-links' , data .find_links ,
197
- '--dest' , '.' , '--interpreter-version' , 'py2 ' , 'simplewheel'
233
+ '--dest' , '.' , '--interpreter-version' , '2 ' , 'simplewheel'
198
234
)
199
235
assert (
200
236
Path ('scratch' ) / 'simplewheel-2.0-py2.py3-none-any.whl'
@@ -203,10 +239,160 @@ def test_download_specify_interpreter_version(script, data):
203
239
204
240
result = script .pip (
205
241
'download' , '--no-index' , '--find-links' , data .find_links ,
206
- '--dest' , '.' , '--interpreter-version' , 'py3 ' ,
242
+ '--dest' , '.' , '--interpreter-version' , '3 ' ,
207
243
'requires_source'
208
244
)
209
245
assert (
210
246
Path ('scratch' ) / 'requires_source-1.0-py2.py3-none-any.whl'
211
247
in result .files_created
212
248
)
249
+
250
+ # No py3 provided for version 1.
251
+ result = script .pip (
252
+ 'download' , '--no-index' , '--find-links' , data .find_links ,
253
+ '--dest' , '.' , '--interpreter-version' , '3' , 'simpleinterpdist==1.0' ,
254
+ expect_error = True ,
255
+ )
256
+
257
+
258
+ # Because of the existing compatibility semantics, a "cp27" wheel IS considered
259
+ # compatible with the pep425 tags for a plain interpreter version of "27".
260
+ # (Is this correct? cp27 seems more specific than "27", i.e. "py27")
261
+ result = script .pip (
262
+ 'download' , '--no-index' , '--find-links' , data .find_links ,
263
+ '--dest' , '.' , '--interpreter-version' , '27' , 'simpleinterpdist==1.0'
264
+ )
265
+ assert (
266
+ Path ('scratch' ) / 'simpleinterpdist-1.0-cp27-none-any.whl'
267
+ in result .files_created
268
+ )
269
+
270
+ # Because of the existing compatibility semantics, a "cp27" wheel is not considered
271
+ # compatible with the pep425 tags for a plain interpreter version of "2".
272
+ # (Is this correct? Given the above behavior, it seems like "xp27" should satisfy "py2"
273
+ # if "xp27" would satisfy "py27")
274
+ result = script .pip (
275
+ 'download' , '--no-index' , '--find-links' , data .find_links ,
276
+ '--dest' , '.' , '--interpreter-version' , '2' , 'simpleinterpdist==1.0' ,
277
+ expect_error = True ,
278
+ )
279
+
280
+ result = script .pip (
281
+ 'download' , '--no-index' , '--find-links' , data .find_links ,
282
+ '--dest' , '.' , '--interpreter-version' , '2' , 'simpleinterpdist'
283
+ )
284
+ assert (
285
+ Path ('scratch' ) / 'simpleinterpdist-2.0-py2.py3-none-any.whl'
286
+ in result .files_created
287
+ )
288
+
289
+ result = script .pip (
290
+ 'download' , '--no-index' , '--find-links' , data .find_links ,
291
+ '--dest' , './scratch2' , '--interpreter-version' , '3' , 'simpleinterpdist' ,
292
+ )
293
+ assert (
294
+ Path ('scratch' ) / 'scratch2' / 'simpleinterpdist-2.0-py2.py3-none-any.whl'
295
+ in result .files_created
296
+ )
297
+
298
+
299
+ @pytest .mark .network
300
+ def test_download_specify_interpreter_version_and_platform (script , data ):
301
+ """
302
+ Test using "pip download --interpreter-version X --platform Y" to download
303
+ a .whl archive supported for a specific interpreter and version combination.
304
+ """
305
+ result = script .pip (
306
+ 'download' , '--no-index' , '--find-links' , data .find_links ,
307
+ '--dest' , '.' ,
308
+ '--interpreter-version' , '2' ,
309
+ '--platform' , 'linux_x86_64' ,
310
+ 'simpleinterpplatdist==1'
311
+ )
312
+ assert (
313
+ Path ('scratch' ) / 'simpleinterpplatdist-1.0-py2.py3-none-any.whl'
314
+ in result .files_created
315
+ )
316
+ script .pip (
317
+ 'download' , '--no-index' , '--find-links' , data .find_links ,
318
+ '--dest' , '.' ,
319
+ '--interpreter-version' , '3' ,
320
+ '--platform' , 'linux_x86_64' ,
321
+ 'simpleinterpplatdist==1'
322
+ )
323
+ script .pip (
324
+ 'download' , '--no-index' , '--find-links' , data .find_links ,
325
+ '--dest' , '.' ,
326
+ '--interpreter-version' , '3' ,
327
+ '--platform' , 'macosx_10_9_x86_64.whl' ,
328
+ 'simpleinterpplatdist'
329
+ )
330
+
331
+ result = script .pip (
332
+ 'download' , '--no-index' , '--find-links' , data .find_links ,
333
+ '--dest' , '.' ,
334
+ '--interpreter-version' , '27' ,
335
+ '--platform' , 'linux_x86_64' ,
336
+ 'simpleinterpplatdist==2'
337
+ )
338
+ assert (
339
+ Path ('scratch' ) / 'simpleinterpplatdist-2.0-cp27-none-linux_x86_64.whl'
340
+ in result .files_created
341
+ )
342
+
343
+ result = script .pip (
344
+ 'download' , '--no-index' , '--find-links' , data .find_links ,
345
+ '--dest' , '.' ,
346
+ '--interpreter-version' , '27' ,
347
+ '--platform' , 'macosx_10_10_x86_64' ,
348
+ 'simpleinterpplatdist==2'
349
+ )
350
+ assert (
351
+ Path ('scratch' ) / 'simpleinterpplatdist-2.0-cp27-none-macosx_10_9_x86_64.whl'
352
+ in result .files_created
353
+ )
354
+
355
+ result = script .pip (
356
+ 'download' , '--no-index' , '--find-links' , data .find_links ,
357
+ '--dest' , '.' ,
358
+ '--interpreter-version' , '2' ,
359
+ '--platform' , 'linux_x86_64' ,
360
+ 'simpleinterpplatdist==2'
361
+ )
362
+ assert (
363
+ Path ('scratch' ) / 'simpleinterpplatdist-2.0-py2.py3-none-linux_x86_64.whl'
364
+ in result .files_created
365
+ )
366
+
367
+ result = script .pip (
368
+ 'download' , '--no-index' , '--find-links' , data .find_links ,
369
+ '--dest' , '.' ,
370
+ '--interpreter-version' , '3' ,
371
+ '--platform' , 'macosx_10_10_x86_64' ,
372
+ 'simpleinterpplatdist==2'
373
+ )
374
+ assert (
375
+ Path ('scratch' ) / 'simpleinterpplatdist-2.0-py2.py3-none-macosx_10_9_x86_64.whl'
376
+ in result .files_created
377
+ )
378
+
379
+ result = script .pip (
380
+ 'download' , '--no-index' , '--find-links' , data .find_links ,
381
+ '--dest' , '.' ,
382
+ '--interpreter-version' , '3' ,
383
+ '--platform' , 'fake_platform' ,
384
+ 'simpleinterpplatdist==2' ,
385
+ expect_error = True ,
386
+ )
387
+
388
+ result = script .pip (
389
+ 'download' , '--no-index' , '--find-links' , data .find_links ,
390
+ '--dest' , '.' ,
391
+ '--interpreter-version' , '3' ,
392
+ '--platform' , 'fake_platform' ,
393
+ 'simpleinterpdist==2'
394
+ )
395
+ assert (
396
+ Path ('scratch' ) / 'simpleinterpdist-2.0-py2.py3-none-any.whl'
397
+ in result .files_created
398
+ )
0 commit comments