Skip to content

Commit 813145d

Browse files
authored
Skip the Core ML wheel test on Python 3.14 (pytorch#21841)
## The problem The Python 3.14 wheel jobs on Linux x86_64 and macOS fail in their smoke test with: ``` ModuleNotFoundError: No module named 'coremltools' ``` The reason is that the wheel does not declare `coremltools` on Python 3.14, because that release publishes no build for it. The declaration in `setup.py` already says so: ``` coremltools==9.0; (platform_system == 'Darwin' or platform_system == 'Linux') and python_version < '3.14' ``` But the two wheel smoke tests run a Core ML case unconditionally: ``` .ci/scripts/wheel/test_linux.py backend=Backend.CoreMlExportOnly .ci/scripts/wheel/test_macos.py backend=Backend.CoreMlExportAndTest ``` So on 3.14 that case fails on the missing import rather than testing Core ML at all. The other platforms are unaffected, because no other wheel test script runs a Core ML case. The pin cannot simply be raised. The first `coremltools` release with any Python 3.14 file is a development release, which pip will not choose unless it is explicitly asked for pre-releases. ## The fix Skip that one case on Python 3.14 and print why, leaving the rest of the smoke test in place: ```python if sys.version_info < (3, 14): model_tests.append( test_base.ModelTest(model=Model.Mv3, backend=Backend.CoreMlExportOnly) ) else: print("Skipping the Core ML case: coremltools has no Python 3.14 build") ``` The XNNPACK case still runs on every version, so the wheel is still exercised on 3.14. This is the smallest change that matches what the wheel actually installs. ## Testing Verified: - Read the failing job logs and confirmed the missing `coremltools` import is what stops the test. - Confirmed `setup.py` already excludes `coremltools` on 3.14, so the test was asking for something the wheel does not ship. - Confirmed no wheel test script other than these two names a Core ML backend, which matches the aarch64 and Windows jobs getting past this stage. - Both files parse, and lint and formatting are clean. Not verified: - A full wheel build or its smoke tests on Python 3.14.
1 parent 79e3eae commit 813145d

2 files changed

Lines changed: 35 additions & 18 deletions

File tree

‎.ci/scripts/wheel/test_linux.py‎

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# LICENSE file in the root directory of this source tree.
88

99
import platform
10+
import sys
1011

1112
import test_base
1213
from examples.models import Backend, Model
@@ -41,15 +42,22 @@
4142

4243
test_base.test_cmsis_nn_install()
4344

44-
test_base.run_tests(
45-
model_tests=[
46-
test_base.ModelTest(
47-
model=Model.Mv3,
48-
backend=Backend.XnnpackQuantizationDelegation,
49-
),
45+
model_tests = [
46+
test_base.ModelTest(
47+
model=Model.Mv3,
48+
backend=Backend.XnnpackQuantizationDelegation,
49+
),
50+
]
51+
# The wheel declares coremltools only below 3.14, because that release publishes no build for
52+
# it, so on 3.14 this case would fail on the missing import rather than exercise Core ML.
53+
if sys.version_info < (3, 14):
54+
model_tests.append(
5055
test_base.ModelTest(
5156
model=Model.Mv3,
5257
backend=Backend.CoreMlExportOnly,
53-
),
54-
]
55-
)
58+
)
59+
)
60+
else:
61+
print("Skipping the Core ML case: coremltools has no Python 3.14 build")
62+
63+
test_base.run_tests(model_tests=model_tests)

‎.ci/scripts/wheel/test_macos.py‎

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,30 @@
66
# This source code is licensed under the BSD-style license found in the
77
# LICENSE file in the root directory of this source tree.
88

9+
import sys
10+
911
import test_base
1012
from examples.models import Backend, Model
1113

1214
if __name__ == "__main__":
1315
test_base.test_cmsis_nn_install()
1416

15-
test_base.run_tests(
16-
model_tests=[
17-
test_base.ModelTest(
18-
model=Model.Mv3,
19-
backend=Backend.XnnpackQuantizationDelegation,
20-
),
17+
model_tests = [
18+
test_base.ModelTest(
19+
model=Model.Mv3,
20+
backend=Backend.XnnpackQuantizationDelegation,
21+
),
22+
]
23+
# The wheel declares coremltools only below 3.14, because that release publishes no build for
24+
# it, so on 3.14 this case would fail on the missing import rather than exercise Core ML.
25+
if sys.version_info < (3, 14):
26+
model_tests.append(
2127
test_base.ModelTest(
2228
model=Model.Mv3,
2329
backend=Backend.CoreMlExportAndTest,
24-
),
25-
]
26-
)
30+
)
31+
)
32+
else:
33+
print("Skipping the Core ML case: coremltools has no Python 3.14 build")
34+
35+
test_base.run_tests(model_tests=model_tests)

0 commit comments

Comments
 (0)