Skip to content

Commit 92382eb

Browse files
committed
Handle run_tests.py removal in Python 3.13
1 parent c8abcae commit 92382eb

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

cpython-unix/build-cpython.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -912,8 +912,11 @@ cp -av Modules/config.c.in ${ROOT}/out/python/build/Modules/
912912
cp -av Python/frozen.c ${ROOT}/out/python/build/Python/
913913
cp -av Modules/Setup* ${ROOT}/out/python/build/Modules/
914914

915-
# Copy the test hardness runner for convenience.
916-
cp -av Tools/scripts/run_tests.py ${ROOT}/out/python/build/
915+
# Copy the test harness runner for convenience.
916+
# In Python 3.13+, this script is not needed to run tests and is not present.
917+
if [ -d Tools/scripts/run_tests.py ]; then
918+
cp -av Tools/scripts/run_tests.py ${ROOT}/out/python/build/
919+
fi
917920

918921
mkdir ${ROOT}/out/python/licenses
919922
cp ${ROOT}/LICENSE.*.txt ${ROOT}/out/python/licenses/

cpython-windows/build.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -1700,10 +1700,18 @@ def build_cpython(
17001700
log("copying %s to %s" % (source, dest))
17011701
shutil.copyfile(source, dest)
17021702

1703-
shutil.copyfile(
1704-
cpython_source_path / "Tools" / "scripts" / "run_tests.py",
1705-
out_dir / "python" / "build" / "run_tests.py",
1706-
)
1703+
# CPython 3.13 removed `run_tests.py`.
1704+
if meets_python_minimum_version(python_version, "3.13"):
1705+
# TODO(zanieb): Write a script to invoke `python -m test --slow-ci`
1706+
# or update the metadata to not require `run_tests.py`
1707+
pathlib.Path(
1708+
out_dir / "python" / "build" / "run_tests.py",
1709+
).touch()
1710+
else:
1711+
shutil.copyfile(
1712+
cpython_source_path / "Tools" / "scripts" / "run_tests.py",
1713+
out_dir / "python" / "build" / "run_tests.py",
1714+
)
17071715

17081716
licenses_dir = out_dir / "python" / "licenses"
17091717
licenses_dir.mkdir()

0 commit comments

Comments
 (0)