File: test_build.py

package info (click to toggle)
python-setuptools-rust 1.12.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 660 kB
  • sloc: python: 1,815; javascript: 95; sh: 14; makefile: 13
file content (28 lines) | stat: -rw-r--r-- 1,038 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from unittest import mock

from setuptools_rust.build import _adjusted_local_rust_target


def test_adjusted_local_rust_target_windows_msvc():
    with mock.patch(
        "setuptools_rust.rustc_info.get_rust_target_info",
        lambda _plat_name, _env: ["target_env=msvc"],
    ):
        assert _adjusted_local_rust_target("win32", None) == "i686-pc-windows-msvc"
        assert (
            _adjusted_local_rust_target("win-amd64", None) == "x86_64-pc-windows-msvc"
        )


def test_adjusted_local_rust_target_windows_gnu():
    with mock.patch(
        "setuptools_rust.rustc_info.get_rust_target_info",
        lambda _plat_name, _env: ["target_env=gnu"],
    ):
        assert _adjusted_local_rust_target("win32", None) == "i686-pc-windows-gnu"
        assert _adjusted_local_rust_target("win-amd64", None) == "x86_64-pc-windows-gnu"


def test_adjusted_local_rust_target_macos():
    with mock.patch("platform.machine", lambda: "x86_64"):
        assert _adjusted_local_rust_target("macosx-", None) == "x86_64-apple-darwin"