Skip to content

Commit a25d40c

Browse files
tests: use 'build' in tests instead of running setup.py (#3734)
Co-authored-by: Anderson Bravalheri <[email protected]> Co-authored-by: Anderson Bravalheri <[email protected]>
1 parent a97e9d8 commit a25d40c

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=42", "wheel", "cmake>=3.18", "ninja"]
2+
requires = ["setuptools>=42", "cmake>=3.18", "ninja"]
33
build-backend = "setuptools.build_meta"
44

55
[tool.check-manifest]

tests/extra_python_package/test_files.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,19 @@ def test_build_sdist(monkeypatch, tmpdir):
108108
out = subprocess.check_output(
109109
[
110110
sys.executable,
111-
"setup.py",
112-
"sdist",
113-
"--formats=tar",
114-
"--dist-dir",
111+
"-m",
112+
"build",
113+
"--sdist",
114+
"--outdir",
115115
str(tmpdir),
116116
]
117117
)
118118
if hasattr(out, "decode"):
119119
out = out.decode()
120120

121-
(sdist,) = tmpdir.visit("*.tar")
121+
(sdist,) = tmpdir.visit("*.tar.gz")
122122

123-
with tarfile.open(str(sdist)) as tar:
123+
with tarfile.open(str(sdist), "r:gz") as tar:
124124
start = tar.getnames()[0] + "/"
125125
version = start[9:-1]
126126
simpler = {n.split("/", 1)[-1] for n in tar.getnames()[1:]}
@@ -169,23 +169,23 @@ def test_build_global_dist(monkeypatch, tmpdir):
169169

170170
monkeypatch.chdir(MAIN_DIR)
171171
monkeypatch.setenv("PYBIND11_GLOBAL_SDIST", "1")
172-
173172
out = subprocess.check_output(
174173
[
175174
sys.executable,
176-
"setup.py",
177-
"sdist",
178-
"--formats=tar",
179-
"--dist-dir",
175+
"-m",
176+
"build",
177+
"--sdist",
178+
"--outdir",
180179
str(tmpdir),
181180
]
182181
)
182+
183183
if hasattr(out, "decode"):
184184
out = out.decode()
185185

186-
(sdist,) = tmpdir.visit("*.tar")
186+
(sdist,) = tmpdir.visit("*.tar.gz")
187187

188-
with tarfile.open(str(sdist)) as tar:
188+
with tarfile.open(str(sdist), "r:gz") as tar:
189189
start = tar.getnames()[0] + "/"
190190
version = start[16:-1]
191191
simpler = {n.split("/", 1)[-1] for n in tar.getnames()[1:]}

tests/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
build==0.7.0
12
numpy==1.21.5; platform_python_implementation=="PyPy" and sys_platform=="linux" and python_version=="3.7"
23
numpy==1.19.3; platform_python_implementation!="PyPy" and python_version=="3.6"
34
numpy==1.21.5; platform_python_implementation!="PyPy" and python_version>="3.7" and python_version<"3.10"

0 commit comments

Comments
 (0)