Skip to content

Commit 97ed979

Browse files
scripts/test.py: avoid test failures from cibw's recent default to include free-threading.
Recently cibuildwheel has started to build and test with Python free-threading, but some of our tests currently fail so we now disable free-threading by default. Also improved how CIBW_SKIP is handled, to allow testing with free-threading.
1 parent a707524 commit 97ed979

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

scripts/test.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@
9595
--cibw-release-2
9696
Set up so that `cibw` builds only linux-aarch64 wheel.
9797
98+
--cibw-skip-add-defaults 0|1
99+
If 1 (the default) we add defaults to CIBW_SKIP such as `pp*` (to
100+
exclude pypy) and `cp3??t-*` (to exclude free-threading).
101+
98102
--cibw-test-project 0|1
99103
If 1, command `cibw` will use a minimal test project instead of the
100104
PyMuPDF directory itself.
@@ -406,6 +410,7 @@ def main(argv):
406410
cibw_name = None
407411
cibw_pyodide = None
408412
cibw_pyodide_version = None
413+
cibw_skip_add_defaults = True
409414
cibw_test_project = None
410415
commands = list()
411416
env_extra = dict()
@@ -474,7 +479,7 @@ def main(argv):
474479
env_extra['CIBW_ARCHS_LINUX'] = 'auto64'
475480
env_extra['CIBW_ARCHS_MACOS'] = 'auto64'
476481
env_extra['CIBW_ARCHS_WINDOWS'] = 'auto' # win32 and win64.
477-
env_extra['CIBW_SKIP'] = 'pp* *i686 cp36* cp37* *musllinux*aarch64*'
482+
env_extra['CIBW_SKIP'] = '*musllinux*aarch64*'
478483

479484
elif arg == '--cibw-release-2':
480485
env_extra['CIBW_ARCHS_LINUX'] = 'aarch64'
@@ -493,6 +498,9 @@ def main(argv):
493498
elif arg == '--cibw-pyodide':
494499
cibw_pyodide = int(next(args))
495500

501+
elif arg == '--cibw-skip-add-defaults':
502+
cibw_skip_add_defaults = int(next(args))
503+
496504
elif arg == '--cibw-test-project':
497505
cibw_test_project = int(next(args))
498506

@@ -707,6 +715,7 @@ def main(argv):
707715
cibw_pyodide_version,
708716
cibw_sdist,
709717
cibw_test_project,
718+
cibw_skip_add_defaults,
710719
)
711720

712721
elif command == 'install':
@@ -857,6 +866,7 @@ def cibuildwheel(
857866
cibw_pyodide_version,
858867
cibw_sdist,
859868
cibw_test_project,
869+
cibw_skip_add_defaults,
860870
):
861871

862872
if cibw_sdist and platform.system() == 'Linux':
@@ -871,9 +881,19 @@ def cibuildwheel(
871881
# Some general flags.
872882
if 'CIBW_BUILD_VERBOSITY' not in env_extra:
873883
env_extra['CIBW_BUILD_VERBOSITY'] = '1'
874-
if 'CIBW_SKIP' not in env_extra:
875-
env_extra['CIBW_SKIP'] = 'pp* *i686 cp36* cp37* *musllinux* *-win32 *-aarch64'
876-
884+
885+
# Add default flags to CIBW_SKIP.
886+
# 2025-10-07: `cp3??t-*` excludes free-threading, which currently breaks
887+
# some tests.
888+
889+
if cibw_skip_add_defaults:
890+
CIBW_SKIP = env_extra.get('CIBW_SKIP', '')
891+
CIBW_SKIP += ' pp* *i686 cp36* cp37* *musllinux* *-win32 *-aarch64 cp3??t-*'
892+
CIBW_SKIP = CIBW_SKIP.split()
893+
CIBW_SKIP = sorted(list(set(CIBW_SKIP)))
894+
CIBW_SKIP = ' '.join(CIBW_SKIP)
895+
env_extra['CIBW_SKIP'] = CIBW_SKIP
896+
877897
# Set what wheels to build, if not already specified.
878898
if 'CIBW_ARCHS' not in env_extra:
879899
if 'CIBW_ARCHS_WINDOWS' not in env_extra:

0 commit comments

Comments
 (0)