From 552e7a6b787bb082f120fdbe259c248dc8af15bb Mon Sep 17 00:00:00 2001 From: Mike Foster Date: Fri, 14 Jun 2024 07:45:21 +0200 Subject: [PATCH] only run tests on windows --- unit_test/get_platform_test.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/unit_test/get_platform_test.py b/unit_test/get_platform_test.py index ccc5273fb..c3d00b4a3 100644 --- a/unit_test/get_platform_test.py +++ b/unit_test/get_platform_test.py @@ -1,5 +1,6 @@ # ruff: noqa: ARG001 import contextlib +import sys from pathlib import Path from typing import Dict @@ -8,11 +9,14 @@ from cibuildwheel.windows import PythonConfiguration, setup_setuptools_cross_compile +# monkeypatching os.name is too flaky. E.g. It works on my machine, but fails in pipeline +if not sys.platform.startswith("win"): + pytest.skip("Windows-only tests", allow_module_level=True) + @contextlib.contextmanager def patched_environment(monkeypatch: pytest.MonkeyPatch, environment: Dict[str, str]): with monkeypatch.context() as mp: - mp.setattr("os.name", "nt") for envvar, val in environment.items(): mp.setenv(name=envvar, value=val) yield