@@ -62,11 +62,17 @@ def build_editable(wheel_directory, config_settings=None, metadata_directory=Non
62
62
63
63
64
64
def _make_project (
65
- tmpdir : Path , backend_code : str , with_setup_py : bool , with_pyproject : bool = True
65
+ tmpdir : Path ,
66
+ backend_code : str ,
67
+ * ,
68
+ with_setup_py : bool ,
69
+ with_setup_cfg : bool = True ,
70
+ with_pyproject : bool = True ,
66
71
) -> Path :
67
72
project_dir = tmpdir / "project"
68
73
project_dir .mkdir ()
69
- project_dir .joinpath ("setup.cfg" ).write_text (SETUP_CFG )
74
+ if with_setup_cfg :
75
+ project_dir .joinpath ("setup.cfg" ).write_text (SETUP_CFG )
70
76
if with_setup_py :
71
77
project_dir .joinpath ("setup.py" ).write_text (SETUP_PY )
72
78
if backend_code :
@@ -259,3 +265,19 @@ def test_download_editable_pep660_basic(
259
265
_assert_hook_not_called (project_dir , "prepare_metadata_for_build_editable" )
260
266
_assert_hook_called (project_dir , "prepare_metadata_for_build_wheel" )
261
267
assert len (os .listdir (str (download_dir ))) == 1 , "a zip should have been created"
268
+
269
+
270
+ def test_install_editable_unsupported_by_backend (
271
+ tmpdir : Path , script : PipTestEnvironment
272
+ ) -> None :
273
+ """
274
+ Check that pip errors out when installing a project whose backend does not
275
+ support PEP 660 and falling back to a legacy editable install is impossible
276
+ (no 'setup.py' or 'setup.py.cfg').
277
+ """
278
+ project_dir = _make_project (
279
+ tmpdir , BACKEND_WITHOUT_PEP660 , with_setup_py = False , with_setup_cfg = False
280
+ )
281
+ result = script .pip ("install" , "--editable" , project_dir , expect_error = True )
282
+ assert "editable-mode-unsupported-by-backend" in result .stderr
283
+ assert "Consider using a build backend that supports PEP 660" in result .stderr
0 commit comments