(monkeypatch, tmpdir)
| 182 | |
| 183 | |
| 184 | def test_build_sdist(monkeypatch, tmpdir): |
| 185 | monkeypatch.chdir(MAIN_DIR) |
| 186 | |
| 187 | subprocess.run( |
| 188 | [sys.executable, "-m", "build", "--sdist", f"--outdir={tmpdir}", *UV_ARGS], |
| 189 | check=True, |
| 190 | ) |
| 191 | |
| 192 | (sdist,) = tmpdir.visit("*.tar.gz") |
| 193 | version = FILENAME_VERSION.search(sdist.basename).group(1) |
| 194 | |
| 195 | with tarfile.open(str(sdist), "r:gz") as tar: |
| 196 | simpler = {n.split("/", 1)[-1] for n in tar.getnames()[1:]} |
| 197 | (pkg_info_path,) = (n for n in simpler if n.endswith("PKG-INFO")) |
| 198 | |
| 199 | pyproject_toml = read_tz_file(tar, "pyproject.toml") |
| 200 | pkg_info = read_tz_file(tar, pkg_info_path).decode("utf-8") |
| 201 | |
| 202 | files = headers | sdist_files |
| 203 | assert files <= simpler |
| 204 | |
| 205 | assert b'name = "pybind11"' in pyproject_toml |
| 206 | assert f"Version: {version}" in pkg_info |
| 207 | assert "License-Expression: BSD-3-Clause" in pkg_info |
| 208 | assert "License-File: LICENSE" in pkg_info |
| 209 | assert "Provides-Extra: global" in pkg_info |
| 210 | assert f'Requires-Dist: pybind11-global=={version}; extra == "global"' in pkg_info |
| 211 | |
| 212 | |
| 213 | def test_build_global_dist(monkeypatch, tmpdir): |
nothing calls this directly
no test coverage detected