Skip to content

Commit b9d1d55

Browse files
authored
[CI] Use local setuptools wheel for build dependency when testing from custom index (#5109)
2 parents 8825a5b + 3b0d2d9 commit b9d1d55

File tree

2 files changed

+37
-21
lines changed

2 files changed

+37
-21
lines changed

setuptools/tests/fixtures.py

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -187,30 +187,44 @@ def make_sdist(dist_path, files):
187187
dist.addfile(file_info, fileobj=file_bytes)
188188

189189

190-
def make_trivial_sdist(dist_path, distname, version):
190+
def make_trivial_sdist(dist_path, distname, version, setuptools_wheel=None):
191191
"""
192192
Create a simple sdist tarball at dist_path, containing just a simple
193193
setup.py.
194-
"""
195194
196-
make_sdist(
197-
dist_path,
198-
[
199-
(
200-
'setup.py',
201-
DALS(
202-
f"""\
203-
import setuptools
204-
setuptools.setup(
205-
name={distname!r},
206-
version={version!r}
207-
)
208-
"""
209-
),
195+
If ``setuptools_wheel`` is passed, a ``pyproject.toml`` file will also
196+
be generated and the passed value will be used as location for
197+
setuptools (as build dependency).
198+
"""
199+
files = [
200+
(
201+
'setup.py',
202+
DALS(
203+
f"""\
204+
import setuptools
205+
setuptools.setup(
206+
name={distname!r},
207+
version={version!r}
208+
)
209+
"""
210210
),
211-
('setup.cfg', ''),
212-
],
213-
)
211+
),
212+
('setup.cfg', ''),
213+
]
214+
215+
if setuptools_wheel:
216+
files.append((
217+
"pyproject.toml",
218+
DALS(
219+
f"""\
220+
[build-system]
221+
requires = ["setuptools @ {setuptools_wheel.as_uri()}"]
222+
build-backend = "setuptools.build_meta"
223+
"""
224+
),
225+
))
226+
227+
make_sdist(dist_path, files)
214228

215229

216230
def make_nspkg_sdist(dist_path, distname, version):

setuptools/tests/test_dist.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from distutils.errors import DistutilsSetupError
1616

1717

18-
def test_dist_fetch_build_egg(tmpdir):
18+
def test_dist_fetch_build_egg(tmpdir, setuptools_wheel):
1919
"""
2020
Check multiple calls to `Distribution.fetch_build_egg` work as expected.
2121
"""
@@ -25,7 +25,9 @@ def test_dist_fetch_build_egg(tmpdir):
2525
def sdist_with_index(distname, version):
2626
dist_dir = index.mkdir(distname)
2727
dist_sdist = f'{distname}-{version}.tar.gz'
28-
make_trivial_sdist(str(dist_dir.join(dist_sdist)), distname, version)
28+
make_trivial_sdist(
29+
str(dist_dir.join(dist_sdist)), distname, version, setuptools_wheel
30+
)
2931
with dist_dir.join('index.html').open('w') as fp:
3032
fp.write(
3133
DALS(

0 commit comments

Comments
 (0)