Skip to content

Commit 4ff3fcc

Browse files
committed
Add an integration test exercising the scenario from #3512.
1 parent d3e23c9 commit 4ff3fcc

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ test = [
9090
"flaky>=3.8.1",
9191
"hatch-vcs>=0.4",
9292
"hatchling>=1.27",
93+
"pdm-backend",
9394
"psutil>=6.1.1",
9495
"pytest>=8.3.4",
9596
"pytest-cov>=5",

tests/tox_env/python/virtual_env/package/conftest.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,41 @@ def pkg_with_extras_project(tmp_path_factory: pytest.TempPathFactory) -> Path:
4040
toml = '[build-system]\nrequires=["setuptools", "wheel"]\nbuild-backend = "setuptools.build_meta"'
4141
(tmp_path / "pyproject.toml").write_text(toml)
4242
return tmp_path
43+
44+
45+
@pytest.fixture(scope="session")
46+
def pkg_with_pdm_backend(
47+
tmp_path_factory: pytest.TempPathFactory,
48+
pkg_builder: Callable[[Path, Path, list[str], bool], Path],
49+
) -> Path:
50+
tmp_path = tmp_path_factory.mktemp("skeleton")
51+
52+
pyproject_toml = f"""
53+
[build-system]
54+
requires = ["pdm-backend"]
55+
build-backend = "pdm.backend"
56+
57+
[project]
58+
name = "skeleton"
59+
description = "Just a skeleton for reproducing #3512."
60+
version = "0.1.1337"
61+
dependencies = [
62+
"requests",
63+
]
64+
65+
[tool.pdm.build]
66+
includes = [
67+
"skeleton/",
68+
]
69+
source-includes = [
70+
"tox.ini",
71+
]
72+
"""
73+
(tmp_path / "pyproject.toml").write_text(dedent(pyproject_toml))
74+
(tmp_path / "skeleton").mkdir(exist_ok=True)
75+
(tmp_path / "skeleton" / "__init__.py").touch()
76+
77+
dist = tmp_path / "dist"
78+
pkg_builder(dist, tmp_path, ["sdist"], False)
79+
80+
return tmp_path

tests/tox_env/python/virtual_env/package/test_package_pyproject.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,3 +458,27 @@ def test_pyproject_config_settings_editable_legacy(
458458
"get_requires_for_build_wheel": {"C": "3"},
459459
"prepare_metadata_for_build_wheel": {"D": "4"},
460460
}
461+
462+
463+
@pytest.mark.usefixtures("enable_pip_pypi_access")
464+
def test_aaa_pyproject_installpkg_pep517_envs(
465+
tox_project: ToxProjectCreator,
466+
pkg_with_pdm_backend: Path,
467+
) -> None:
468+
# Regression test for #3512
469+
tox_ini = """
470+
[tox]
471+
envlist = dummy1,dummy2
472+
473+
[testenv:dummy1]
474+
commands =
475+
python -c print(1)
476+
477+
[testenv:dummy2]
478+
commands =
479+
python -c print(42)
480+
"""
481+
sdist = pkg_with_pdm_backend / "dist" / "skeleton-0.1.1337.tar.gz"
482+
proj = tox_project({"tox.ini": tox_ini}, base=pkg_with_pdm_backend)
483+
result = proj.run("--installpkg", str(sdist), "--exit-and-dump-after", "10")
484+
result.assert_success()

0 commit comments

Comments
 (0)