Skip to content

Commit 08f22de

Browse files
authored
tests: work when CMAKE_GENERATOR is set (#1066)
Fix for conda-forge/scikit-build-core-feedstock#63. Signed-off-by: Henry Schreiner <[email protected]>
1 parent 056ed33 commit 08f22de

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/scikit_build_core/program_search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def get_cmake_program(cmake_path: Path) -> Program:
129129
def get_cmake_programs(*, module: bool = True) -> Generator[Program, None, None]:
130130
"""
131131
Get the path and version for CMake. If the version cannot be determined,
132-
yiels (path, None). Otherwise, yields (path, version). Best matches are
132+
yields (path, None). Otherwise, yields (path, version). Best matches are
133133
yielded first.
134134
"""
135135
for cmake_path in _get_cmake_path(module=module):

tests/test_build_cli.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,22 @@
2828

2929

3030
@pytest.mark.parametrize("mode", ["sdist", "wheel", "editable"])
31+
@pytest.mark.parametrize("force_make", [False, True])
3132
def test_requires_command(
3233
capsys: pytest.CaptureFixture[str],
3334
monkeypatch: pytest.MonkeyPatch,
3435
tmp_path: Path,
3536
mode: str,
37+
force_make: bool,
3638
) -> None:
3739
monkeypatch.setattr(
3840
sys, "argv", ["scikit_build_core.build", "requires", f"--mode={mode}"]
3941
)
4042
monkeypatch.setattr(shutil, "which", lambda _: None)
43+
monkeypatch.delenv("CMAKE_GENERATOR", raising=False)
44+
monkeypatch.delenv("CMAKE_ARGS", raising=False)
45+
if force_make:
46+
monkeypatch.setenv("CMAKE_GENERATOR", "Makefiles")
4147
(tmp_path / "pyproject.toml").write_text(PYPROJECT_1)
4248
monkeypatch.chdir(tmp_path)
4349

@@ -48,7 +54,7 @@ def test_requires_command(
4854
jout = json.loads(out)
4955
if mode == "sdist":
5056
assert frozenset(jout) == {"scikit-build-core", "setuptools-scm"}
51-
elif sysconfig.get_platform().startswith("win-"):
57+
elif sysconfig.get_platform().startswith("win-") or force_make:
5258
assert frozenset(jout) == {
5359
"cmake>=3.15",
5460
"scikit-build-core",

0 commit comments

Comments
 (0)