2
2
3
3
import os
4
4
import sys
5
+ import sysconfig
5
6
import threading
6
7
import unittest .mock as mock
7
8
from distutils import _msvccompiler
8
9
from distutils .errors import DistutilsPlatformError
9
10
from distutils .tests import support
11
+ from distutils .util import get_platform
10
12
11
13
import pytest
12
14
@@ -28,6 +30,28 @@ def _find_vcvarsall(plat_spec):
28
30
'wont find this version' ,
29
31
)
30
32
33
+ @pytest .mark .skipif (
34
+ not sysconfig .get_platform ().startswith ("win" ),
35
+ reason = "Only run test for non-mingw Windows platforms" ,
36
+ )
37
+ @pytest .mark .parametrize (
38
+ "plat_name, expected" ,
39
+ [
40
+ ("win-arm64" , "win-arm64" ),
41
+ ("win-amd64" , "win-amd64" ),
42
+ (None , get_platform ()),
43
+ ],
44
+ )
45
+ def test_cross_platform_compilation_paths (self , monkeypatch , plat_name , expected ):
46
+ compiler = _msvccompiler .MSVCCompiler ()
47
+
48
+ # makes sure that the right target platform name is used
49
+ def _get_vcvars_spec (host_platform , platform ):
50
+ assert platform == expected
51
+
52
+ monkeypatch .setattr (_msvccompiler , '_get_vcvars_spec' , _get_vcvars_spec )
53
+ compiler .initialize (plat_name )
54
+
31
55
@needs_winreg
32
56
def test_get_vc_env_unicode (self ):
33
57
test_var = 'ṰḖṤṪ┅ṼẨṜ'
0 commit comments