@@ -1367,10 +1367,12 @@ def test_executor_should_be_initialized_with_correct_workers(
1367
1367
],
1368
1368
)
1369
1369
@pytest .mark .parametrize ("editable" , [False , True ])
1370
+ @pytest .mark .parametrize ("source_type" , ["directory" , "git" ])
1370
1371
def test_build_backend_errors_are_reported_correctly_if_caused_by_subprocess (
1371
1372
failing_method : str ,
1372
1373
exception : Exception ,
1373
1374
editable : bool ,
1375
+ source_type : str ,
1374
1376
mocker : MockerFixture ,
1375
1377
config : Config ,
1376
1378
pool : RepositoryPool ,
@@ -1386,38 +1388,51 @@ def test_build_backend_errors_are_reported_correctly_if_caused_by_subprocess(
1386
1388
1387
1389
package_name = "simple-project"
1388
1390
package_version = "1.2.3"
1389
- directory_package = Package (
1391
+ if source_type == "directory" :
1392
+ source_url = fixture_dir ("simple_project" ).resolve ().as_posix ()
1393
+ source_resolved_reference = None
1394
+ pip_url = path_to_url (source_url )
1395
+ pip_editable_requirement = source_url
1396
+ elif source_type == "git" :
1397
+ source_url = "https://github.com/demo/demo.git"
1398
+ source_resolved_reference = "12345678"
1399
+ pip_url = f"git+{ source_url } "
1400
+ pip_editable_requirement = f"{ pip_url } #egg={ package_name } "
1401
+ else :
1402
+ raise ValueError (f"Unknown source type: { source_type } " )
1403
+ package = Package (
1390
1404
package_name ,
1391
1405
package_version ,
1392
- source_type = "directory" ,
1393
- source_url = fixture_dir ("simple_project" ).resolve ().as_posix (),
1406
+ source_type = source_type ,
1407
+ source_url = source_url ,
1408
+ source_resolved_reference = source_resolved_reference ,
1394
1409
develop = editable ,
1395
1410
)
1396
1411
# must not be included in the error message
1397
- directory_package .python_versions = ">=3.7"
1412
+ package .python_versions = ">=3.7"
1398
1413
1399
- return_code = executor .execute ([Install (directory_package )])
1414
+ return_code = executor .execute ([Install (package )])
1400
1415
1401
1416
assert return_code == 1
1402
1417
1403
- package_url = directory_package .source_url
1404
-
1405
- assert directory_package .source_url is not None
1418
+ assert package .source_url is not None
1406
1419
if editable :
1407
1420
pip_command = "pip wheel --no-cache-dir --use-pep517 --editable"
1408
- requirement = directory_package .source_url
1409
- assert Path (requirement ).exists ()
1421
+ requirement = pip_editable_requirement
1422
+ if source_type == "directory" :
1423
+ assert Path (requirement ).exists ()
1410
1424
else :
1411
1425
pip_command = "pip wheel --no-cache-dir --use-pep517"
1412
- requirement = f"{ package_name } @ { path_to_url ( directory_package . source_url ) } "
1426
+ requirement = f"{ package_name } @ { pip_url } "
1413
1427
1414
- expected_source_string = f"{ package_name } ({ package_version } { package_url } )"
1428
+ version_details = package .source_resolved_reference or package .source_url
1429
+ expected_source_string = f"{ package_name } ({ package_version } { version_details } )"
1415
1430
expected_pip_command = f'{ pip_command } "{ requirement } "'
1416
1431
1417
1432
expected_output = f"""
1418
1433
Package operations: 1 install, 0 updates, 0 removals
1419
1434
1420
- - Installing { package_name } ( { package_version } { package_url } )
1435
+ - Installing { expected_source_string }
1421
1436
1422
1437
PEP517 build of a dependency failed
1423
1438
@@ -1433,7 +1448,8 @@ def test_build_backend_errors_are_reported_correctly_if_caused_by_subprocess(
1433
1448
)
1434
1449
1435
1450
expected_output += f"""
1436
- Note: This error originates from the build backend, and is likely not a problem with poetry but one of the following issues with { expected_source_string }
1451
+ Note: This error originates from the build backend, and is likely not a problem \
1452
+ with poetry but one of the following issues with { expected_source_string }
1437
1453
1438
1454
- not supporting PEP 517 builds
1439
1455
- not specifying PEP 517 build requirements correctly
0 commit comments