Lots more naming changes to reflect that containers are not necessarily 'docker'
This commit is contained in:
@@ -15,7 +15,7 @@ ALL_IDS = {"cp36", "cp37", "cp38", "cp39", "cp310", "pp37", "pp38", "pp39"}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_build_docker(monkeypatch):
|
||||
def mock_build_container(monkeypatch):
|
||||
def fail_on_call(*args, **kwargs):
|
||||
raise RuntimeError("This should never be called")
|
||||
|
||||
@@ -37,56 +37,58 @@ def mock_build_docker(monkeypatch):
|
||||
monkeypatch.setattr(util, "download", fail_on_call)
|
||||
monkeypatch.setattr("cibuildwheel.linux.OCIContainer", ignore_context_call)
|
||||
|
||||
monkeypatch.setattr("cibuildwheel.linux.build_on_docker", mock.Mock(spec=linux.build_on_docker))
|
||||
monkeypatch.setattr(
|
||||
"cibuildwheel.linux.build_in_container", mock.Mock(spec=linux.build_in_container)
|
||||
)
|
||||
monkeypatch.setattr("cibuildwheel.util.print_new_wheels", ignore_context_call)
|
||||
|
||||
|
||||
def test_build_default_launches(mock_build_docker, fake_package_dir, monkeypatch):
|
||||
def test_build_default_launches(mock_build_container, fake_package_dir, monkeypatch):
|
||||
monkeypatch.setattr(sys, "argv", ["cibuildwheel", "--platform=linux"])
|
||||
|
||||
main()
|
||||
|
||||
build_on_docker = cast(mock.Mock, linux.build_on_docker)
|
||||
build_in_container = cast(mock.Mock, linux.build_in_container)
|
||||
|
||||
assert build_on_docker.call_count == 4
|
||||
assert build_in_container.call_count == 4
|
||||
|
||||
# In Python 3.8+, this can be simplified to [0].kwargs
|
||||
kwargs = build_on_docker.call_args_list[0][1]
|
||||
assert "quay.io/pypa/manylinux2014_x86_64" in kwargs["docker"]["image"]
|
||||
assert kwargs["docker"]["cwd"] == PurePosixPath("/project")
|
||||
assert not kwargs["docker"]["simulate_32_bit"]
|
||||
kwargs = build_in_container.call_args_list[0][1]
|
||||
assert "quay.io/pypa/manylinux2014_x86_64" in kwargs["container"]["image"]
|
||||
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
|
||||
assert not kwargs["container"]["simulate_32_bit"]
|
||||
|
||||
identifiers = {x.identifier for x in kwargs["platform_configs"]}
|
||||
assert identifiers == {f"{x}-manylinux_x86_64" for x in ALL_IDS}
|
||||
|
||||
kwargs = build_on_docker.call_args_list[1][1]
|
||||
assert "quay.io/pypa/manylinux2014_i686" in kwargs["docker"]["image"]
|
||||
assert kwargs["docker"]["cwd"] == PurePosixPath("/project")
|
||||
assert kwargs["docker"]["simulate_32_bit"]
|
||||
kwargs = build_in_container.call_args_list[1][1]
|
||||
assert "quay.io/pypa/manylinux2014_i686" in kwargs["container"]["image"]
|
||||
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
|
||||
assert kwargs["container"]["simulate_32_bit"]
|
||||
|
||||
identifiers = {x.identifier for x in kwargs["platform_configs"]}
|
||||
assert identifiers == {f"{x}-manylinux_i686" for x in ALL_IDS}
|
||||
|
||||
kwargs = build_on_docker.call_args_list[2][1]
|
||||
assert "quay.io/pypa/musllinux_1_1_x86_64" in kwargs["docker"]["image"]
|
||||
assert kwargs["docker"]["cwd"] == PurePosixPath("/project")
|
||||
assert not kwargs["docker"]["simulate_32_bit"]
|
||||
kwargs = build_in_container.call_args_list[2][1]
|
||||
assert "quay.io/pypa/musllinux_1_1_x86_64" in kwargs["container"]["image"]
|
||||
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
|
||||
assert not kwargs["container"]["simulate_32_bit"]
|
||||
|
||||
identifiers = {x.identifier for x in kwargs["platform_configs"]}
|
||||
assert identifiers == {
|
||||
f"{x}-musllinux_x86_64" for x in ALL_IDS for x in ALL_IDS if "pp" not in x
|
||||
}
|
||||
|
||||
kwargs = build_on_docker.call_args_list[3][1]
|
||||
assert "quay.io/pypa/musllinux_1_1_i686" in kwargs["docker"]["image"]
|
||||
assert kwargs["docker"]["cwd"] == PurePosixPath("/project")
|
||||
assert kwargs["docker"]["simulate_32_bit"]
|
||||
kwargs = build_in_container.call_args_list[3][1]
|
||||
assert "quay.io/pypa/musllinux_1_1_i686" in kwargs["container"]["image"]
|
||||
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
|
||||
assert kwargs["container"]["simulate_32_bit"]
|
||||
|
||||
identifiers = {x.identifier for x in kwargs["platform_configs"]}
|
||||
assert identifiers == {f"{x}-musllinux_i686" for x in ALL_IDS if "pp" not in x}
|
||||
|
||||
|
||||
def test_build_with_override_launches(mock_build_docker, monkeypatch, tmp_path):
|
||||
def test_build_with_override_launches(mock_build_container, monkeypatch, tmp_path):
|
||||
pkg_dir = tmp_path / "cibw_package"
|
||||
pkg_dir.mkdir()
|
||||
|
||||
@@ -113,23 +115,23 @@ before-all = "true"
|
||||
|
||||
main()
|
||||
|
||||
build_on_docker = cast(mock.Mock, linux.build_on_docker)
|
||||
build_in_container = cast(mock.Mock, linux.build_in_container)
|
||||
|
||||
assert build_on_docker.call_count == 6
|
||||
assert build_in_container.call_count == 6
|
||||
|
||||
kwargs = build_on_docker.call_args_list[0][1]
|
||||
assert "quay.io/pypa/manylinux2014_x86_64" in kwargs["docker"]["image"]
|
||||
assert kwargs["docker"]["cwd"] == PurePosixPath("/project")
|
||||
assert not kwargs["docker"]["simulate_32_bit"]
|
||||
kwargs = build_in_container.call_args_list[0][1]
|
||||
assert "quay.io/pypa/manylinux2014_x86_64" in kwargs["container"]["image"]
|
||||
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
|
||||
assert not kwargs["container"]["simulate_32_bit"]
|
||||
|
||||
identifiers = {x.identifier for x in kwargs["platform_configs"]}
|
||||
assert identifiers == {"cp36-manylinux_x86_64"}
|
||||
assert kwargs["options"].build_options("cp36-manylinux_x86_64").before_all == "true"
|
||||
|
||||
kwargs = build_on_docker.call_args_list[1][1]
|
||||
assert "quay.io/pypa/manylinux2014_x86_64" in kwargs["docker"]["image"]
|
||||
assert kwargs["docker"]["cwd"] == PurePosixPath("/project")
|
||||
assert not kwargs["docker"]["simulate_32_bit"]
|
||||
kwargs = build_in_container.call_args_list[1][1]
|
||||
assert "quay.io/pypa/manylinux2014_x86_64" in kwargs["container"]["image"]
|
||||
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
|
||||
assert not kwargs["container"]["simulate_32_bit"]
|
||||
|
||||
identifiers = {x.identifier for x in kwargs["platform_configs"]}
|
||||
assert identifiers == {
|
||||
@@ -137,10 +139,10 @@ before-all = "true"
|
||||
}
|
||||
assert kwargs["options"].build_options("cp37-manylinux_x86_64").before_all == ""
|
||||
|
||||
kwargs = build_on_docker.call_args_list[2][1]
|
||||
assert "quay.io/pypa/manylinux_2_24_x86_64" in kwargs["docker"]["image"]
|
||||
assert kwargs["docker"]["cwd"] == PurePosixPath("/project")
|
||||
assert not kwargs["docker"]["simulate_32_bit"]
|
||||
kwargs = build_in_container.call_args_list[2][1]
|
||||
assert "quay.io/pypa/manylinux_2_24_x86_64" in kwargs["container"]["image"]
|
||||
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
|
||||
assert not kwargs["container"]["simulate_32_bit"]
|
||||
identifiers = {x.identifier for x in kwargs["platform_configs"]}
|
||||
assert identifiers == {
|
||||
"cp310-manylinux_x86_64",
|
||||
@@ -149,28 +151,28 @@ before-all = "true"
|
||||
"pp39-manylinux_x86_64",
|
||||
}
|
||||
|
||||
kwargs = build_on_docker.call_args_list[3][1]
|
||||
assert "quay.io/pypa/manylinux2014_i686" in kwargs["docker"]["image"]
|
||||
assert kwargs["docker"]["cwd"] == PurePosixPath("/project")
|
||||
assert kwargs["docker"]["simulate_32_bit"]
|
||||
kwargs = build_in_container.call_args_list[3][1]
|
||||
assert "quay.io/pypa/manylinux2014_i686" in kwargs["container"]["image"]
|
||||
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
|
||||
assert kwargs["container"]["simulate_32_bit"]
|
||||
|
||||
identifiers = {x.identifier for x in kwargs["platform_configs"]}
|
||||
assert identifiers == {f"{x}-manylinux_i686" for x in ALL_IDS}
|
||||
|
||||
kwargs = build_on_docker.call_args_list[4][1]
|
||||
assert "quay.io/pypa/musllinux_1_1_x86_64" in kwargs["docker"]["image"]
|
||||
assert kwargs["docker"]["cwd"] == PurePosixPath("/project")
|
||||
assert not kwargs["docker"]["simulate_32_bit"]
|
||||
kwargs = build_in_container.call_args_list[4][1]
|
||||
assert "quay.io/pypa/musllinux_1_1_x86_64" in kwargs["container"]["image"]
|
||||
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
|
||||
assert not kwargs["container"]["simulate_32_bit"]
|
||||
|
||||
identifiers = {x.identifier for x in kwargs["platform_configs"]}
|
||||
assert identifiers == {
|
||||
f"{x}-musllinux_x86_64" for x in ALL_IDS for x in ALL_IDS if "pp" not in x
|
||||
}
|
||||
|
||||
kwargs = build_on_docker.call_args_list[5][1]
|
||||
assert "quay.io/pypa/musllinux_1_1_i686" in kwargs["docker"]["image"]
|
||||
assert kwargs["docker"]["cwd"] == PurePosixPath("/project")
|
||||
assert kwargs["docker"]["simulate_32_bit"]
|
||||
kwargs = build_in_container.call_args_list[5][1]
|
||||
assert "quay.io/pypa/musllinux_1_1_i686" in kwargs["container"]["image"]
|
||||
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
|
||||
assert kwargs["container"]["simulate_32_bit"]
|
||||
|
||||
identifiers = {x.identifier for x in kwargs["platform_configs"]}
|
||||
assert identifiers == {f"{x}-musllinux_i686" for x in ALL_IDS if "pp" not in x}
|
||||
|
||||
Reference in New Issue
Block a user