@@ -41,13 +41,16 @@ def test_install_from_broken_wheel(script, data):
41
41
editable = False )
42
42
43
43
44
- def test_basic_install_from_wheel (script , data ):
44
+ def test_basic_install_from_wheel (script , shared_data , tmpdir ):
45
45
"""
46
46
Test installing from a wheel (that has a script)
47
47
"""
48
+ shutil .copy (
49
+ shared_data .packages / "has.script-1.0-py2.py3-none-any.whl" , tmpdir
50
+ )
48
51
result = script .pip (
49
52
'install' , 'has.script==1.0' , '--no-index' ,
50
- '--find-links=' + data . find_links ,
53
+ '--find-links' , tmpdir ,
51
54
)
52
55
dist_info_folder = script .site_packages / 'has.script-1.0.dist-info'
53
56
assert dist_info_folder in result .files_created , (dist_info_folder ,
@@ -57,13 +60,19 @@ def test_basic_install_from_wheel(script, data):
57
60
assert script_file in result .files_created
58
61
59
62
60
- def test_basic_install_from_wheel_with_extras (script , data ):
63
+ def test_basic_install_from_wheel_with_extras (script , shared_data , tmpdir ):
61
64
"""
62
65
Test installing from a wheel with extras.
63
66
"""
67
+ shutil .copy (
68
+ shared_data .packages / "complex_dist-0.1-py2.py3-none-any.whl" , tmpdir
69
+ )
70
+ shutil .copy (
71
+ shared_data .packages / "simple.dist-0.1-py2.py3-none-any.whl" , tmpdir
72
+ )
64
73
result = script .pip (
65
74
'install' , 'complex-dist[simple]' , '--no-index' ,
66
- '--find-links=' + data . find_links ,
75
+ '--find-links' , tmpdir ,
67
76
)
68
77
dist_info_folder = script .site_packages / 'complex_dist-0.1.dist-info'
69
78
assert dist_info_folder in result .files_created , (dist_info_folder ,
@@ -110,14 +119,17 @@ def test_install_from_wheel_with_headers(script, data):
110
119
result .stdout )
111
120
112
121
113
- def test_install_wheel_with_target (script , data , with_wheel ):
122
+ def test_install_wheel_with_target (script , shared_data , with_wheel , tmpdir ):
114
123
"""
115
124
Test installing a wheel using pip install --target
116
125
"""
126
+ shutil .copy (
127
+ shared_data .packages / "simple.dist-0.1-py2.py3-none-any.whl" , tmpdir
128
+ )
117
129
target_dir = script .scratch_path / 'target'
118
130
result = script .pip (
119
131
'install' , 'simple.dist==0.1' , '-t' , target_dir ,
120
- '--no-index' , '--find-links=' + data . find_links ,
132
+ '--no-index' , '--find-links' , tmpdir ,
121
133
)
122
134
assert Path ('scratch' ) / 'target' / 'simpledist' in result .files_created , (
123
135
str (result )
@@ -159,55 +171,63 @@ def test_install_wheel_with_target_and_data_files(script, data, with_wheel):
159
171
not in result .files_created ), str (result )
160
172
161
173
162
- def test_install_wheel_with_root (script , data ):
174
+ def test_install_wheel_with_root (script , shared_data , tmpdir ):
163
175
"""
164
176
Test installing a wheel using pip install --root
165
177
"""
166
178
root_dir = script .scratch_path / 'root'
179
+ shutil .copy (
180
+ shared_data .packages / "simple.dist-0.1-py2.py3-none-any.whl" , tmpdir
181
+ )
167
182
result = script .pip (
168
183
'install' , 'simple.dist==0.1' , '--root' , root_dir ,
169
- '--no-index' , '--find-links=' + data . find_links ,
184
+ '--no-index' , '--find-links' , tmpdir ,
170
185
)
171
186
assert Path ('scratch' ) / 'root' in result .files_created
172
187
173
188
174
- def test_install_wheel_with_prefix (script , data ):
189
+ def test_install_wheel_with_prefix (script , shared_data , tmpdir ):
175
190
"""
176
191
Test installing a wheel using pip install --prefix
177
192
"""
178
193
prefix_dir = script .scratch_path / 'prefix'
194
+ shutil .copy (
195
+ shared_data .packages / "simple.dist-0.1-py2.py3-none-any.whl" , tmpdir
196
+ )
179
197
result = script .pip (
180
198
'install' , 'simple.dist==0.1' , '--prefix' , prefix_dir ,
181
- '--no-index' , '--find-links=' + data . find_links ,
199
+ '--no-index' , '--find-links' , tmpdir ,
182
200
)
183
201
lib = distutils .sysconfig .get_python_lib (prefix = Path ('scratch' ) / 'prefix' )
184
202
assert lib in result .files_created , str (result )
185
203
186
204
187
- def test_install_from_wheel_installs_deps (script , data ):
205
+ def test_install_from_wheel_installs_deps (script , data , tmpdir ):
188
206
"""
189
207
Test can install dependencies of wheels
190
208
"""
191
209
# 'requires_source' depends on the 'source' project
192
210
package = data .packages .joinpath (
193
211
"requires_source-1.0-py2.py3-none-any.whl"
194
212
)
213
+ shutil .copy (data .packages / "source-1.0.tar.gz" , tmpdir )
195
214
result = script .pip (
196
- 'install' , '--no-index' , '--find-links' , data . find_links , package ,
215
+ 'install' , '--no-index' , '--find-links' , tmpdir , package ,
197
216
)
198
217
result .assert_installed ('source' , editable = False )
199
218
200
219
201
- def test_install_from_wheel_no_deps (script , data ):
220
+ def test_install_from_wheel_no_deps (script , data , tmpdir ):
202
221
"""
203
222
Test --no-deps works with wheel installs
204
223
"""
205
224
# 'requires_source' depends on the 'source' project
206
225
package = data .packages .joinpath (
207
226
"requires_source-1.0-py2.py3-none-any.whl"
208
227
)
228
+ shutil .copy (data .packages / "source-1.0.tar.gz" , tmpdir )
209
229
result = script .pip (
210
- 'install' , '--no-index' , '--find-links' , data . find_links , '--no-deps' ,
230
+ 'install' , '--no-index' , '--find-links' , tmpdir , '--no-deps' ,
211
231
package ,
212
232
)
213
233
pkg_folder = script .site_packages / 'source'
@@ -232,27 +252,34 @@ def test_wheel_record_lines_in_deterministic_order(script, data):
232
252
233
253
234
254
@pytest .mark .incompatible_with_test_venv
235
- def test_install_user_wheel (script , data , with_wheel ):
255
+ def test_install_user_wheel (script , shared_data , with_wheel , tmpdir ):
236
256
"""
237
257
Test user install from wheel (that has a script)
238
258
"""
259
+ shutil .copy (
260
+ shared_data .packages / "has.script-1.0-py2.py3-none-any.whl" , tmpdir
261
+ )
239
262
result = script .pip (
240
263
'install' , 'has.script==1.0' , '--user' , '--no-index' ,
241
- '--find-links=' + data . find_links ,
264
+ '--find-links' , tmpdir ,
242
265
)
243
266
egg_info_folder = script .user_site / 'has.script-1.0.dist-info'
244
267
assert egg_info_folder in result .files_created , str (result )
245
268
script_file = script .user_bin / 'script.py'
246
269
assert script_file in result .files_created , str (result )
247
270
248
271
249
- def test_install_from_wheel_gen_entrypoint (script , data ):
272
+ def test_install_from_wheel_gen_entrypoint (script , shared_data , tmpdir ):
250
273
"""
251
274
Test installing scripts (entry points are generated)
252
275
"""
276
+ shutil .copy (
277
+ shared_data .packages / "script.wheel1a-0.1-py2.py3-none-any.whl" ,
278
+ tmpdir ,
279
+ )
253
280
result = script .pip (
254
281
'install' , 'script.wheel1a==0.1' , '--no-index' ,
255
- '--find-links=' + data . find_links ,
282
+ '--find-links' , tmpdir ,
256
283
)
257
284
if os .name == 'nt' :
258
285
wrapper_file = script .bin / 't1.exe'
@@ -264,13 +291,20 @@ def test_install_from_wheel_gen_entrypoint(script, data):
264
291
assert bool (os .access (script .base_path / wrapper_file , os .X_OK ))
265
292
266
293
267
- def test_install_from_wheel_gen_uppercase_entrypoint (script , data ):
294
+ def test_install_from_wheel_gen_uppercase_entrypoint (
295
+ script , shared_data , tmpdir
296
+ ):
268
297
"""
269
298
Test installing scripts with uppercase letters in entry point names
270
299
"""
300
+ shutil .copy (
301
+ shared_data .packages /
302
+ "console_scripts_uppercase-1.0-py2.py3-none-any.whl" ,
303
+ tmpdir ,
304
+ )
271
305
result = script .pip (
272
306
'install' , 'console-scripts-uppercase==1.0' , '--no-index' ,
273
- '--find-links=' + data . find_links ,
307
+ '--find-links' , tmpdir ,
274
308
)
275
309
if os .name == 'nt' :
276
310
# Case probably doesn't make any difference on NT
@@ -283,13 +317,17 @@ def test_install_from_wheel_gen_uppercase_entrypoint(script, data):
283
317
assert bool (os .access (script .base_path / wrapper_file , os .X_OK ))
284
318
285
319
286
- def test_install_from_wheel_with_legacy (script , data ):
320
+ def test_install_from_wheel_with_legacy (script , shared_data , tmpdir ):
287
321
"""
288
322
Test installing scripts (legacy scripts are preserved)
289
323
"""
324
+ shutil .copy (
325
+ shared_data .packages / "script.wheel2a-0.1-py2.py3-none-any.whl" ,
326
+ tmpdir ,
327
+ )
290
328
result = script .pip (
291
329
'install' , 'script.wheel2a==0.1' , '--no-index' ,
292
- '--find-links=' + data . find_links ,
330
+ '--find-links' , tmpdir ,
293
331
)
294
332
295
333
legacy_file1 = script .bin / 'testscript1.bat'
@@ -299,14 +337,19 @@ def test_install_from_wheel_with_legacy(script, data):
299
337
assert legacy_file2 in result .files_created
300
338
301
339
302
- def test_install_from_wheel_no_setuptools_entrypoint (script , data ):
340
+ def test_install_from_wheel_no_setuptools_entrypoint (
341
+ script , shared_data , tmpdir
342
+ ):
303
343
"""
304
344
Test that when we generate scripts, any existing setuptools wrappers in
305
345
the wheel are skipped.
306
346
"""
347
+ shutil .copy (
348
+ shared_data .packages / "script.wheel1-0.1-py2.py3-none-any.whl" , tmpdir
349
+ )
307
350
result = script .pip (
308
351
'install' , 'script.wheel1==0.1' , '--no-index' ,
309
- '--find-links=' + data . find_links ,
352
+ '--find-links' , tmpdir ,
310
353
)
311
354
if os .name == 'nt' :
312
355
wrapper_file = script .bin / 't1.exe'
@@ -323,14 +366,17 @@ def test_install_from_wheel_no_setuptools_entrypoint(script, data):
323
366
assert wrapper_helper not in result .files_created
324
367
325
368
326
- def test_skipping_setuptools_doesnt_skip_legacy (script , data ):
369
+ def test_skipping_setuptools_doesnt_skip_legacy (script , shared_data , tmpdir ):
327
370
"""
328
371
Test installing scripts (legacy scripts are preserved even when we skip
329
372
setuptools wrappers)
330
373
"""
374
+ shutil .copy (
375
+ shared_data .packages / "script.wheel2-0.1-py2.py3-none-any.whl" , tmpdir
376
+ )
331
377
result = script .pip (
332
378
'install' , 'script.wheel2==0.1' , '--no-index' ,
333
- '--find-links=' + data . find_links ,
379
+ '--find-links' , tmpdir ,
334
380
)
335
381
336
382
legacy_file1 = script .bin / 'testscript1.bat'
@@ -342,13 +388,16 @@ def test_skipping_setuptools_doesnt_skip_legacy(script, data):
342
388
assert wrapper_helper not in result .files_created
343
389
344
390
345
- def test_install_from_wheel_gui_entrypoint (script , data ):
391
+ def test_install_from_wheel_gui_entrypoint (script , shared_data , tmpdir ):
346
392
"""
347
393
Test installing scripts (gui entry points are generated)
348
394
"""
395
+ shutil .copy (
396
+ shared_data .packages / "script.wheel3-0.1-py2.py3-none-any.whl" , tmpdir
397
+ )
349
398
result = script .pip (
350
399
'install' , 'script.wheel3==0.1' , '--no-index' ,
351
- '--find-links=' + data . find_links ,
400
+ '--find-links' , tmpdir ,
352
401
)
353
402
if os .name == 'nt' :
354
403
wrapper_file = script .bin / 't1.exe'
@@ -357,13 +406,16 @@ def test_install_from_wheel_gui_entrypoint(script, data):
357
406
assert wrapper_file in result .files_created
358
407
359
408
360
- def test_wheel_compiles_pyc (script , data ):
409
+ def test_wheel_compiles_pyc (script , shared_data , tmpdir ):
361
410
"""
362
411
Test installing from wheel with --compile on
363
412
"""
413
+ shutil .copy (
414
+ shared_data .packages / "simple.dist-0.1-py2.py3-none-any.whl" , tmpdir
415
+ )
364
416
script .pip (
365
417
"install" , "--compile" , "simple.dist==0.1" , "--no-index" ,
366
- "--find-links=" + data . find_links
418
+ "--find-links" , tmpdir ,
367
419
)
368
420
# There are many locations for the __init__.pyc file so attempt to find
369
421
# any of them
@@ -378,13 +430,16 @@ def test_wheel_compiles_pyc(script, data):
378
430
assert any (exists )
379
431
380
432
381
- def test_wheel_no_compiles_pyc (script , data ):
433
+ def test_wheel_no_compiles_pyc (script , shared_data , tmpdir ):
382
434
"""
383
435
Test installing from wheel with --compile on
384
436
"""
437
+ shutil .copy (
438
+ shared_data .packages / "simple.dist-0.1-py2.py3-none-any.whl" , tmpdir
439
+ )
385
440
script .pip (
386
441
"install" , "--no-compile" , "simple.dist==0.1" , "--no-index" ,
387
- "--find-links=" + data . find_links
442
+ "--find-links" , tmpdir ,
388
443
)
389
444
# There are many locations for the __init__.pyc file so attempt to find
390
445
# any of them
0 commit comments