MCPcopy Create free account
hub / github.com/pybind/pybind11 / test_build_sdist

Function test_build_sdist

tests/extra_python_package/test_files.py:184–210  ·  view source on GitHub ↗
(monkeypatch, tmpdir)

Source from the content-addressed store, hash-verified

182
183
184def 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
213def test_build_global_dist(monkeypatch, tmpdir):

Callers

nothing calls this directly

Calls 3

strClass · 0.85
read_tz_fileFunction · 0.85
runMethod · 0.45

Tested by

no test coverage detected