Add platform-specific arch option unit test
This commit is contained in:
@@ -124,13 +124,16 @@ class DependencyConstraints:
|
||||
|
||||
|
||||
class Architecture(str, Enum):
|
||||
# mac/linux archs
|
||||
x86_64 = 'x86_64'
|
||||
i686 = 'i686'
|
||||
aarch64 = 'aarch64'
|
||||
ppc64le = 'ppc64le'
|
||||
s390x = 's390x'
|
||||
win32 = 'win32'
|
||||
win_amd64 = 'win_amd64'
|
||||
|
||||
# windows archs
|
||||
x86 = 'x86'
|
||||
amd64 = 'AMD64'
|
||||
|
||||
@staticmethod
|
||||
def parse_config(config: str, platform: str) -> 'List[Architecture]':
|
||||
|
||||
@@ -93,3 +93,21 @@ def test_archs_argument(platform, intercepted_build_args, monkeypatch, use_env_v
|
||||
build_options = intercepted_build_args.args[0]
|
||||
|
||||
assert build_options.architectures == [Architecture.ppc64le]
|
||||
|
||||
|
||||
def test_archs_platform_specific(platform, intercepted_build_args, monkeypatch):
|
||||
monkeypatch.setattr(platform_module, 'machine', lambda: 'x86_64')
|
||||
monkeypatch.setenv('CIBW_ARCHS', 'unused')
|
||||
monkeypatch.setenv('CIBW_ARCHS_LINUX', 'ppc64le')
|
||||
monkeypatch.setenv('CIBW_ARCHS_WINDOWS', 'x86')
|
||||
monkeypatch.setenv('CIBW_ARCHS_MACOS', 'x86_64')
|
||||
|
||||
main()
|
||||
build_options = intercepted_build_args.args[0]
|
||||
|
||||
if platform == 'linux':
|
||||
assert build_options.architectures == [Architecture.ppc64le]
|
||||
elif platform == 'windows':
|
||||
assert build_options.architectures == [Architecture.x86]
|
||||
elif platform == 'macos':
|
||||
assert build_options.architectures == [Architecture.x86_64]
|
||||
|
||||
Reference in New Issue
Block a user