* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.4 → v0.4.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.4...v0.4.5) - [github.com/codespell-project/codespell: v2.2.6 → v2.3.0](https://github.com/codespell-project/codespell/compare/v2.2.6...v2.3.0) - [github.com/python-jsonschema/check-jsonschema: 0.28.3 → 0.28.4](https://github.com/python-jsonschema/check-jsonschema/compare/0.28.3...0.28.4) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
44 lines
1.0 KiB
Python
44 lines
1.0 KiB
Python
from __future__ import annotations
|
|
|
|
import subprocess
|
|
|
|
import pytest
|
|
|
|
from test import test_projects
|
|
|
|
from . import utils
|
|
|
|
basic_project = test_projects.new_c_project()
|
|
basic_project.files["repair.py"] = """
|
|
import shutil
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
wheel = Path(sys.argv[1])
|
|
dest_dir = Path(sys.argv[2])
|
|
platform = wheel.stem.split("-")[-1]
|
|
name = f"spam-0.1.0-py2-none-{platform}.whl"
|
|
dest = dest_dir / name
|
|
dest_dir.mkdir(parents=True, exist_ok=True)
|
|
if dest.exists():
|
|
dest.unlink()
|
|
shutil.copy(wheel, dest)
|
|
"""
|
|
|
|
|
|
def test(tmp_path, capfd):
|
|
# this test checks that a generated wheel name shall be unique in a given cibuildwheel run
|
|
project_dir = tmp_path / "project"
|
|
basic_project.generate(project_dir)
|
|
|
|
with pytest.raises(subprocess.CalledProcessError):
|
|
utils.cibuildwheel_run(
|
|
project_dir,
|
|
add_env={
|
|
"CIBW_REPAIR_WHEEL_COMMAND": "python repair.py {wheel} {dest_dir}",
|
|
},
|
|
)
|
|
|
|
captured = capfd.readouterr()
|
|
assert "Build failed because a wheel named" in captured.err
|