Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 33 additions & 19 deletions setuptools/tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,30 +187,44 @@ def make_sdist(dist_path, files):
dist.addfile(file_info, fileobj=file_bytes)


def make_trivial_sdist(dist_path, distname, version):
def make_trivial_sdist(dist_path, distname, version, setuptools_wheel=None):
"""
Create a simple sdist tarball at dist_path, containing just a simple
setup.py.
"""

make_sdist(
dist_path,
[
(
'setup.py',
DALS(
f"""\
import setuptools
setuptools.setup(
name={distname!r},
version={version!r}
)
"""
),
If ``setuptools_wheel`` is passed, a ``pyproject.toml`` file will also
be generated and the passed value will be used as location for
setuptools (as build dependency).
"""
files = [
(
'setup.py',
DALS(
f"""\
import setuptools
setuptools.setup(
name={distname!r},
version={version!r}
)
"""
),
('setup.cfg', ''),
],
)
),
('setup.cfg', ''),
]

if setuptools_wheel:
files.append((
"pyproject.toml",
DALS(
f"""\
[build-system]
requires = ["setuptools @ {setuptools_wheel.as_uri()}"]
build-backend = "setuptools.build_meta"
"""
),
))

make_sdist(dist_path, files)


def make_nspkg_sdist(dist_path, distname, version):
Expand Down
6 changes: 4 additions & 2 deletions setuptools/tests/test_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from distutils.errors import DistutilsSetupError


def test_dist_fetch_build_egg(tmpdir):
def test_dist_fetch_build_egg(tmpdir, setuptools_wheel):
"""
Check multiple calls to `Distribution.fetch_build_egg` work as expected.
"""
Expand All @@ -25,7 +25,9 @@ def test_dist_fetch_build_egg(tmpdir):
def sdist_with_index(distname, version):
dist_dir = index.mkdir(distname)
dist_sdist = f'{distname}-{version}.tar.gz'
make_trivial_sdist(str(dist_dir.join(dist_sdist)), distname, version)
make_trivial_sdist(
str(dist_dir.join(dist_sdist)), distname, version, setuptools_wheel
)
with dist_dir.join('index.html').open('w') as fp:
fp.write(
DALS(
Expand Down
Loading