Skip to content

Commit 69e1539

Browse files
committed
cpython: define list of test packages in distribution
I've been wanting to do this for a while so downstream consumers can filter test packages without having to maintain their own lists of package names.
1 parent c120317 commit 69e1539

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

README.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,10 @@ python_stdlib
304304
Relative path to Python's standard library (where ``.py`` and resource
305305
files are located).
306306

307+
python_stdlib_test_packages
308+
Array of strings of Python packages that define tests. (Version 4 or above
309+
only.)
310+
307311
link_mode
308312
How `libpython` is linked. Values can be one of the following:
309313

cpython-unix/build.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@
1515
import docker
1616

1717
from pythonbuild.buildenv import build_environment
18-
from pythonbuild.cpython import derive_setup_local, parse_config_c, parse_setup_line
18+
from pythonbuild.cpython import (
19+
derive_setup_local,
20+
parse_config_c,
21+
parse_setup_line,
22+
STDLIB_TEST_PACKAGES,
23+
)
1924
from pythonbuild.docker import build_docker_image, get_image
2025
from pythonbuild.downloads import DOWNLOADS
2126
from pythonbuild.logging import log, set_logger
@@ -649,6 +654,7 @@ def build_cpython(
649654
"python_exe": "install/bin/%s" % fully_qualified_name,
650655
"python_include": "install/include/%s" % fully_qualified_name,
651656
"python_stdlib": "install/lib/python%s" % entry["version"][0:3],
657+
"python_stdlib_test_packages": sorted(STDLIB_TEST_PACKAGES),
652658
"link_mode": "static",
653659
"build_info": python_build_info(
654660
build_env,

cpython-windows/build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import concurrent.futures
88
import datetime
99
import json
10-
import multiprocessing
1110
import os
1211
import pathlib
1312
import re
@@ -18,7 +17,7 @@
1817
import zipfile
1918

2019
from pythonbuild.downloads import DOWNLOADS
21-
from pythonbuild.cpython import parse_config_c
20+
from pythonbuild.cpython import parse_config_c, STDLIB_TEST_PACKAGES
2221
from pythonbuild.utils import (
2322
create_tar_from_directory,
2423
download_entry,
@@ -1749,6 +1748,7 @@ def build_cpython(arch: str, profile):
17491748
"python_exe": "install/python.exe",
17501749
"python_include": "install/include",
17511750
"python_stdlib": "install/Lib",
1751+
"python_stdlib_test_packages": sorted(STDLIB_TEST_PACKAGES),
17521752
"link_mode": "static" if static else "shared",
17531753
"build_info": build_info,
17541754
"licenses": DOWNLOADS["cpython-3.7"]["licenses"],

pythonbuild/cpython.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,22 @@
6666
b"_testcapi"
6767
}
6868

69+
# Packages that define tests.
70+
STDLIB_TEST_PACKAGES = {
71+
"bsddb.test",
72+
"ctypes.test",
73+
"distutils.tests",
74+
"email.test",
75+
"idlelib.idle_test",
76+
"json.tests",
77+
"lib-tk.test",
78+
"lib2to3.tests",
79+
"sqlite3.test",
80+
"test",
81+
"tkinter.test",
82+
"unittest.test",
83+
}
84+
6985

7086
def parse_setup_line(line: bytes, variant: str):
7187
"""Parse a line in a ``Setup.*`` file."""

0 commit comments

Comments
 (0)