Skip to content

Commit c30f52a

Browse files
authored
tests: fix local runs on AS macOS (#1182)
Fixes an issue running this locally. Updating the CI a bit. Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
1 parent 583dafd commit c30f52a

File tree

4 files changed

+76
-8
lines changed

4 files changed

+76
-8
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
persist-credentials: false
3030
- uses: actions/setup-python@v6
3131
with:
32-
python-version: "3.12"
32+
python-version: "3.13"
3333
- uses: astral-sh/setup-uv@v7
3434
- name: Install nox
3535
run: uv tool install nox
@@ -94,10 +94,9 @@ jobs:
9494
- python-version: "3.12"
9595
runs-on: windows-latest
9696
cmake-version: "3.26.x"
97-
# TODO: CMake doesn't work with beta 1 on Windows
98-
# - python-version: "3.14"
99-
# runs-on: windows-latest
100-
# cmake-version: "4.0.x"
97+
- python-version: "3.14"
98+
runs-on: windows-latest
99+
cmake-version: "4.0.x"
101100
- python-version: "3.13"
102101
runs-on: windows-latest
103102
cmake-version: "3.26.x"
@@ -120,9 +119,6 @@ jobs:
120119
with:
121120
python-version: ${{ matrix.python-version }}
122121
allow-prereleases: true
123-
# Python 3.13.4 broken on Windows
124-
check-latest: >-
125-
${{ matrix.python-version == '3.13' && runner.os == 'Windows' }}
126122

127123
- uses: astral-sh/setup-uv@v7
128124

tests/test_cmake_config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ def test_get_cmake_via_envvar(monkeypatch: pytest.MonkeyPatch, fp):
245245
fp.register(
246246
[cmake_path, "-E", "capabilities"], stdout='{"version":{"string":"3.20.0"}}'
247247
)
248+
fp.register(
249+
["lipo", "-info", "some-prog"],
250+
stdout="Architectures in the fat file: ... are: x86_64 arm64",
251+
)
248252
monkeypatch.setenv("CMAKE_EXECUTABLE", str(cmake_path))
249253
result = CMake.default_search(env=os.environ)
250254
assert result.cmake_path == cmake_path

tests/test_get_requires.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ def test_get_requires_parts(fp: FakeProcess):
3131
[Path("cmake/path"), "-E", "capabilities"],
3232
stdout='{"version":{"string":"3.14.0"}}',
3333
)
34+
fp.register(
35+
["lipo", "-info", "cmake/path"],
36+
stdout="Architectures in the fat file: ... are: x86_64 arm64",
37+
)
3438
assert set(GetRequires().cmake()) == {"cmake>=3.15"}
3539
assert set(GetRequires().ninja()) == {*ninja}
3640

@@ -40,6 +44,10 @@ def test_get_requires_parts_uneeded(fp: FakeProcess):
4044
[Path("cmake/path"), "-E", "capabilities"],
4145
stdout='{"version":{"string":"3.18.0"}}',
4246
)
47+
fp.register(
48+
["lipo", "-info", "cmake/path"],
49+
stdout="Architectures in the fat file: ... are: x86_64 arm64",
50+
)
4351
assert set(GetRequires().cmake()) == set()
4452
assert set(GetRequires().ninja()) == {*ninja}
4553

@@ -49,6 +57,10 @@ def test_get_requires_parts_settings(fp: FakeProcess):
4957
[Path("cmake/path"), "-E", "capabilities"],
5058
stdout='{"version":{"string":"3.18.0"}}',
5159
)
60+
fp.register(
61+
["lipo", "-info", "cmake/path"],
62+
stdout="Architectures in the fat file: ... are: x86_64 arm64",
63+
)
5264
config = {"cmake.version": ">=3.20"}
5365
assert set(GetRequires.from_config_settings(config).cmake()) == {"cmake>=3.20"}
5466
assert set(GetRequires.from_config_settings(config).ninja()) == {*ninja}
@@ -68,6 +80,10 @@ def test_get_requires_parts_pyproject(
6880
[Path("cmake/path"), "-E", "capabilities"],
6981
stdout='{"version":{"string":"3.18.0"}}',
7082
)
83+
fp.register(
84+
["lipo", "-info", "cmake/path"],
85+
stdout="Architectures in the fat file: ... are: x86_64 arm64",
86+
)
7187

7288
assert set(GetRequires().cmake()) == {"cmake>=3.21"}
7389
assert set(GetRequires().ninja()) == {*ninja}
@@ -89,6 +105,10 @@ def test_get_requires_parts_pyproject_old(
89105
[Path("cmake/path"), "-E", "capabilities"],
90106
stdout='{"version":{"string":"3.18.0"}}',
91107
)
108+
fp.register(
109+
["lipo", "-info", "cmake/path"],
110+
stdout="Architectures in the fat file: ... are: x86_64 arm64",
111+
)
92112

93113
assert set(GetRequires().cmake()) == {"cmake>=3.21"}
94114
assert set(GetRequires().ninja()) == {*ninja}
@@ -99,6 +119,10 @@ def test_get_requires_for_build_sdist(fp: FakeProcess):
99119
[Path("cmake/path"), "-E", "capabilities"],
100120
stdout='{"version":{"string":"3.14.0"}}',
101121
)
122+
fp.register(
123+
["lipo", "-info", "cmake/path"],
124+
stdout="Architectures in the fat file: ... are: x86_64 arm64",
125+
)
102126
assert set(get_requires_for_build_sdist({})) == set()
103127

104128

@@ -108,6 +132,10 @@ def test_get_requires_for_build_sdist_cmake(fp: FakeProcess):
108132
[Path("cmake/path"), "-E", "capabilities"],
109133
stdout='{"version":{"string":"3.14.0"}}',
110134
)
135+
fp.register(
136+
["lipo", "-info", "cmake/path"],
137+
stdout="Architectures in the fat file: ... are: x86_64 arm64",
138+
)
111139
assert set(get_requires_for_build_sdist({"sdist.cmake": "True"})) == expected
112140

113141

@@ -117,6 +145,10 @@ def test_get_requires_for_build_wheel(fp: FakeProcess):
117145
[Path("cmake/path"), "-E", "capabilities"],
118146
stdout='{"version":{"string":"3.14.0"}}',
119147
)
148+
fp.register(
149+
["lipo", "-info", "cmake/path"],
150+
stdout="Architectures in the fat file: ... are: x86_64 arm64",
151+
)
120152
assert set(get_requires_for_build_wheel({})) == expected
121153

122154

@@ -125,6 +157,10 @@ def test_get_requires_for_build_wheel_pure(fp: FakeProcess):
125157
[Path("cmake/path"), "-E", "capabilities"],
126158
stdout='{"version":{"string":"3.14.0"}}',
127159
)
160+
fp.register(
161+
["lipo", "-info", "cmake/path"],
162+
stdout="Architectures in the fat file: ... are: x86_64 arm64",
163+
)
128164
assert set(get_requires_for_build_wheel({"wheel.cmake": "False"})) == set()
129165

130166

@@ -134,6 +170,10 @@ def test_get_requires_for_build_editable(fp: FakeProcess):
134170
[Path("cmake/path"), "-E", "capabilities"],
135171
stdout='{"version":{"string":"3.14.0"}}',
136172
)
173+
fp.register(
174+
["lipo", "-info", "cmake/path"],
175+
stdout="Architectures in the fat file: ... are: x86_64 arm64",
176+
)
137177
assert set(get_requires_for_build_editable({})) == expected
138178

139179

@@ -142,4 +182,8 @@ def test_get_requires_for_build_editable_pure(fp: FakeProcess):
142182
[Path("cmake/path"), "-E", "capabilities"],
143183
stdout='{"version":{"string":"3.14.0"}}',
144184
)
185+
fp.register(
186+
["lipo", "-info", "cmake/path"],
187+
stdout="Architectures in the fat file: ... are: x86_64 arm64",
188+
)
145189
assert set(get_requires_for_build_editable({"wheel.cmake": "False"})) == set()

tests/test_program_search.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ def test_get_cmake_programs_all(monkeypatch, fp):
4949
[cmake3_path, "-E", "capabilities"],
5050
stdout='{"version":{"string":"3.19.0"}}',
5151
)
52+
fp.register(
53+
["lipo", "-info", cmake_path],
54+
stdout="Architectures in the fat file: ... are: x86_64 arm64",
55+
)
56+
fp.register(
57+
["lipo", "-info", cmake3_path],
58+
stdout="Architectures in the fat file: ... are: x86_64 arm64",
59+
)
5260
programs = list(get_cmake_programs(module=False))
5361
assert len(programs) == 2
5462
assert programs[0].path.name == "cmake3"
@@ -71,6 +79,14 @@ def test_get_ninja_programs_all(monkeypatch, fp):
7179
ninja_build_path = Path("ninja-build")
7280
fp.register([ninja_path, "--version"], stdout="1.10.1.git.kitware.jobserver-1")
7381
fp.register([ninja_build_path, "--version"], stdout="1.8.2")
82+
fp.register(
83+
["lipo", "-info", ninja_path],
84+
stdout="Architectures in the fat file: ... are: x86_64 arm64",
85+
)
86+
fp.register(
87+
["lipo", "-info", ninja_build_path],
88+
stdout="Architectures in the fat file: ... are: x86_64 arm64",
89+
)
7490
programs = list(get_ninja_programs(module=False))
7591
assert len(programs) == 2
7692
assert programs[0].path.name == "ninja-build"
@@ -94,6 +110,14 @@ def test_get_cmake_programs_malformed(monkeypatch, fp, caplog):
94110
cmake3_path = Path("cmake3")
95111
fp.register([cmake_path, "-E", "capabilities"], stdout="scrambled output\n")
96112
fp.register([cmake3_path, "-E", "capabilities"], stdout="{}")
113+
fp.register(
114+
["lipo", "-info", cmake_path],
115+
stdout="Architectures in the fat file: ... are: x86_64 arm64",
116+
)
117+
fp.register(
118+
["lipo", "-info", cmake3_path],
119+
stdout="Architectures in the fat file: ... are: x86_64 arm64",
120+
)
97121
programs = list(get_cmake_programs(module=False))
98122
assert caplog.records
99123
assert "Could not determine CMake version" in str(caplog.records[0].msg)

0 commit comments

Comments
 (0)