Skip to content

Commit

Permalink
update test_env_set to validate FatalError is raised on env collision
Browse files Browse the repository at this point in the history
  • Loading branch information
MusicalNinjaDad committed Jul 3, 2024
1 parent 5e92849 commit e859276
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions unit_test/get_platform_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import pytest
import setuptools._distutils.util

from cibuildwheel.errors import FatalError
from cibuildwheel.util import CIProvider, detect_ci_provider
from cibuildwheel.windows import PythonConfiguration, setup_setuptools_cross_compile

Expand Down Expand Up @@ -68,18 +69,14 @@ def test_arm(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
assert target_platform == "win-arm64"


def test_env_set(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
def test_env_set(tmp_path: Path):
arch = "32"
environment = {"VSCMD_ARG_TGT_ARCH": "x64"}

configuration = PythonConfiguration("irrelevant", arch, "irrelevant", None)

setup_setuptools_cross_compile(tmp_path, configuration, tmp_path, environment)
with patched_environment(monkeypatch, environment):
target_platform = setuptools._distutils.util.get_platform()

assert environment["VSCMD_ARG_TGT_ARCH"] == "x64"
assert target_platform == "win-amd64"
with pytest.raises(FatalError, match="VSCMD_ARG_TGT_ARCH"):
setup_setuptools_cross_compile(tmp_path, configuration, tmp_path, environment)


def test_env_blank(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
Expand Down

0 comments on commit e859276

Please sign in to comment.