Skip to content

Commit 1ca95b6

Browse files
committed
Use build to create pip sdist for testing
Also remove direct `setup.py` invocation in `conftest.py`.
1 parent 0ad4c94 commit 1ca95b6

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

news/12545.trivial.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This change will use ``build`` to create the ``pip`` sdist for testing.
2+
3+
It will also remove a direct ``setup.py`` invocation to install ``pip`` in
4+
editable mode to run from tests.

noxfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ def test(session: nox.Session) -> None:
8989
shutil.rmtree(sdist_dir, ignore_errors=True)
9090

9191
# fmt: off
92-
session.install("setuptools")
92+
session.install("build")
9393
session.run(
94-
"python", "setup.py", "sdist", "--formats=zip", "--dist-dir", sdist_dir,
94+
"python", "-m", "build", "--sdist", "--outdir", sdist_dir,
9595
silent=True,
9696
)
9797
# fmt: on

tests/conftest.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import os
66
import re
77
import shutil
8-
import subprocess
98
import sys
109
import threading
1110
from dataclasses import dataclass
@@ -454,15 +453,14 @@ def virtualenv_template(
454453
install_pth_link(venv, "wheel", wheel_install)
455454
pip_editable = tmpdir_factory.mktemp("pip") / "pip"
456455
shutil.copytree(pip_src, pip_editable, symlinks=True)
456+
457457
# noxfile.py is Python 3 only
458458
assert compileall.compile_dir(
459459
str(pip_editable),
460460
quiet=1,
461461
rx=re.compile("noxfile.py$"),
462462
)
463-
subprocess.check_call(
464-
[os.fspath(venv.bin / "python"), "setup.py", "-q", "develop"], cwd=pip_editable
465-
)
463+
install_pth_link(venv, "pip", pip_editable / "src")
466464

467465
# Install coverage and pth file for executing it in any spawned processes
468466
# in this virtual environment.

0 commit comments

Comments
 (0)