Skip to content

Commit

Permalink
only run tests on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
MusicalNinjaDad committed Jun 14, 2024
1 parent 57f8ddd commit 552e7a6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion unit_test/get_platform_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# ruff: noqa: ARG001
import contextlib
import sys
from pathlib import Path
from typing import Dict

Expand All @@ -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
Expand Down

0 comments on commit 552e7a6

Please sign in to comment.