-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Henry Schreiner <[email protected]>
- Loading branch information
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from __future__ import annotations | ||
|
||
import os | ||
import subprocess | ||
import sys | ||
import sysconfig | ||
|
||
import pytest | ||
|
||
from scikit_build_core.builder.cross_compile import set_cross_compile_env | ||
|
||
|
||
@pytest.mark.skipif( | ||
sysconfig.get_config_var("SOABI") != "cp311-win_amd64", | ||
reason="Only tests 'cp311-win_amd64', got {sysconfig.get_config_var('SOABI')!r}", | ||
) | ||
def test_environment(): | ||
env = os.environ.copy() | ||
cmd = [ | ||
sys.executable, | ||
"-c", | ||
"import sysconfig; print(sysconfig.get_config_var('SOABI'), sysconfig.get_config_var('EXT_SUFFIX'))", | ||
] | ||
|
||
with set_cross_compile_env(".cp311-win_arm64.pyd", env): | ||
result = subprocess.run( | ||
cmd, check=True, capture_output=True, text=True, env=env | ||
) | ||
soabi, ext_suffix = result.stdout.strip().split() | ||
assert soabi == "cp311-win_arm64" | ||
assert ext_suffix == ".cp311-win_arm64.pyd" | ||
|
||
result = subprocess.run(cmd, check=True, capture_output=True, text=True, env=env) | ||
soabi, ext_suffix = result.stdout.strip().split() | ||
assert soabi == "cp311-win_amd64" | ||
assert ext_suffix == ".cp311-win_amd64.pyd" |