@@ -59,19 +59,22 @@ def build_editable(wheel_directory, config_settings=None, metadata_directory=Non
59
59
# fmt: on
60
60
61
61
62
- def _make_project (tmpdir , backend_code , with_setup_py ):
62
+ def _make_project (tmpdir , backend_code , with_setup_py , with_pyproject = True ):
63
63
project_dir = tmpdir / "project"
64
64
project_dir .mkdir ()
65
65
project_dir .joinpath ("setup.cfg" ).write_text (SETUP_CFG )
66
66
if with_setup_py :
67
67
project_dir .joinpath ("setup.py" ).write_text (SETUP_PY )
68
68
if backend_code :
69
+ assert with_pyproject
69
70
buildsys = {"requires" : ["setuptools" , "wheel" ]}
70
71
buildsys ["build-backend" ] = "test_backend"
71
72
buildsys ["backend-path" ] = ["." ]
72
73
data = tomli_w .dumps ({"build-system" : buildsys })
73
74
project_dir .joinpath ("pyproject.toml" ).write_text (data )
74
75
project_dir .joinpath ("test_backend.py" ).write_text (backend_code )
76
+ elif with_pyproject :
77
+ project_dir .joinpath ("pyproject.toml" ).touch ()
75
78
project_dir .joinpath ("log.txt" ).touch ()
76
79
return project_dir
77
80
@@ -124,7 +127,8 @@ def test_install_pep660_basic(tmpdir, script, with_wheel):
124
127
def test_install_no_pep660_setup_py_fallback (tmpdir , script , with_wheel ):
125
128
"""
126
129
Test that we fall back to setuptools develop when using a backend that
127
- does not support build_editable .
130
+ does not support build_editable. Since there is a pyproject.toml,
131
+ the prepare_metadata_for_build_wheel hook is called.
128
132
"""
129
133
project_dir = _make_project (tmpdir , BACKEND_WITHOUT_PEP660 , with_setup_py = True )
130
134
result = script .pip (
@@ -135,6 +139,7 @@ def test_install_no_pep660_setup_py_fallback(tmpdir, script, with_wheel):
135
139
project_dir ,
136
140
allow_stderr_warning = False ,
137
141
)
142
+ _assert_hook_called (project_dir , "prepare_metadata_for_build_wheel" )
138
143
assert (
139
144
result .test_env .site_packages .joinpath ("project.egg-link" )
140
145
in result .files_created
@@ -144,7 +149,8 @@ def test_install_no_pep660_setup_py_fallback(tmpdir, script, with_wheel):
144
149
def test_install_no_pep660_setup_cfg_fallback (tmpdir , script , with_wheel ):
145
150
"""
146
151
Test that we fall back to setuptools develop when using a backend that
147
- does not support build_editable .
152
+ does not support build_editable. Since there is a pyproject.toml,
153
+ the prepare_metadata_for_build_wheel hook is called.
148
154
"""
149
155
project_dir = _make_project (tmpdir , BACKEND_WITHOUT_PEP660 , with_setup_py = False )
150
156
result = script .pip (
@@ -156,6 +162,7 @@ def test_install_no_pep660_setup_cfg_fallback(tmpdir, script, with_wheel):
156
162
allow_stderr_warning = False ,
157
163
)
158
164
print (result .stdout , result .stderr )
165
+ _assert_hook_called (project_dir , "prepare_metadata_for_build_wheel" )
159
166
assert (
160
167
result .test_env .site_packages .joinpath ("project.egg-link" )
161
168
in result .files_created
0 commit comments