@@ -1391,17 +1391,25 @@ def test_install_pep508_with_url_in_install_requires(script):
1391
1391
assert "Successfully installed packaging-15.3" in str (res ), str (res )
1392
1392
1393
1393
1394
- def test_install_pep508_with_url_in_install_requires_url_change (script ):
1395
- dep_v1_path = create_basic_wheel_for_package (
1396
- script , name = 'dep' , version = '1.0' ,
1397
- )
1398
- dep_v2_path = create_basic_wheel_for_package (
1399
- script , name = 'dep' , version = '2.0' ,
1400
- )
1394
+ @pytest .mark .parametrize ('create_dep, format' , [
1395
+ (create_test_package_with_setup , 'directory' ),
1396
+ (create_basic_wheel_for_package , 'wheel' ),
1397
+ ])
1398
+ def test_install_pep508_with_url_in_install_requires_url_change (
1399
+ create_dep , format , script ):
1400
+ dep_v1_path = create_dep (script , name = 'dep' , version = '1.0' )
1401
+
1402
+ if format == 'directory' :
1403
+ # Rename the package directory so it doesn't get overwritten when
1404
+ # creating the package for dep_v2
1405
+ dep_v1_path .move (dep_v1_path .folder / 'dep_v1' )
1406
+ dep_v1_path = dep_v1_path .folder / 'dep_v1'
1407
+
1408
+ dep_v2_path = create_dep (script , name = 'dep' , version = '2.0' )
1401
1409
1402
1410
pkga_path = create_basic_wheel_for_package (
1403
1411
script , name = 'pkga' , version = '1.0' ,
1404
- depends = ['dep @ file://%s' % dep_v1_path ],
1412
+ depends = ['dep @ ' + path_to_url ( dep_v1_path ) ],
1405
1413
)
1406
1414
res = script .pip ('install' , pkga_path )
1407
1415
assert "Successfully installed dep-1.0" in str (res ), str (res )
@@ -1411,14 +1419,20 @@ def test_install_pep508_with_url_in_install_requires_url_change(script):
1411
1419
# Updating the URL to the dependency installs the updated dependency
1412
1420
pkga_path = create_basic_wheel_for_package (
1413
1421
script , name = 'pkga' , version = '2.0' ,
1414
- depends = ['dep @ file://%s' % dep_v2_path ],
1422
+ depends = ['dep @ ' + path_to_url ( dep_v2_path ) ],
1415
1423
)
1416
1424
res = script .pip ('install' , pkga_path )
1417
1425
assert "Successfully installed dep-2.0" in str (res ), str (res )
1418
1426
1419
- # The dependency is not reinstalled if the URL doesn't change
1420
1427
res = script .pip ('install' , pkga_path )
1421
- assert "Requirement already satisfied: dep==2.0" in str (res ), str (res )
1428
+ if format == 'directory' :
1429
+ # pip can't determine versions from a directory name, so it will always
1430
+ # reinstall the dependency
1431
+ assert "Successfully installed dep-2.0" in str (res ), str (res )
1432
+ else :
1433
+ # pip can determine the version from a wheel's filename, so the
1434
+ # dependency is not reinstalled if the URL doesn't change
1435
+ assert "Requirement already satisfied: dep==2.0" in str (res ), str (res )
1422
1436
1423
1437
1424
1438
@pytest .mark .network
0 commit comments