Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Czaki committed Feb 7, 2024
1 parent d0d99c6 commit 0fd885d
Showing 1 changed file with 54 additions and 1 deletion.
55 changes: 54 additions & 1 deletion delocate/tests/test_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,60 @@ def test_delocate_wheel_verify_name_universal2_ok(
)


@pytest.mark.xfail( # type: ignore[misc]
sys.platform != "darwin", reason="Needs macOS linkage."
)
def test_delocate_wheel_verify_name_universal_ok(
plat_wheel: PlatWheel, script_runner: ScriptRunner, tmp_path: Path
) -> None:
zip2dir(plat_wheel.whl, tmp_path / "plat")
shutil.copy(
DATA_PATH / "np-1.6.0_intel_lib__compiled_base.so",
tmp_path / "plat/fakepkg1/np-1.6.0_intel_lib__compiled_base.so",
)
whl_10_9 = tmp_path / "plat-1.0-cp311-cp311-macosx_10_9_universal.whl"
dir2zip(tmp_path / "plat", whl_10_9)
script_runner.run(
[
"delocate-wheel",
whl_10_9,
"--require-target-macos-version",
"10.9",
"--ignore-missing-dependencies",
],
check=True,
cwd=tmp_path,
)


@pytest.mark.xfail( # type: ignore[misc]
sys.platform != "darwin", reason="Needs macOS linkage."
)
def test_delocate_wheel_missing_architecture(
plat_wheel: PlatWheel,
script_runner: ScriptRunner,
tmp_path: Path,
monkeypatch: pytest.MonkeyPatch,
) -> None:
shutil.copy(
plat_wheel.whl,
tmp_path / "plat2-1.0-cp311-cp311-macosx_10_9_universal.whl",
)
result = script_runner.run(
[
"delocate-wheel",
tmp_path / "plat2-1.0-cp311-cp311-macosx_10_9_universal.whl",
],
check=False,
cwd=tmp_path,
)
assert result.returncode != 0
assert (
"Failed to find any binary with the required architecture: 'i386'"
in result.stderr
)


@pytest.mark.xfail( # type: ignore[misc]
sys.platform != "darwin", reason="Needs macOS linkage."
)
Expand All @@ -729,7 +783,6 @@ def test_delocate_wheel_verify_name_universal2_verify_crash(
)
whl_10_9 = tmp_path / "plat2-1.0-cp311-cp311-macosx_10_9_universal2.whl"
dir2zip(tmp_path / "plat", whl_10_9)
monkeypatch.setenv("MACOSX_DEPLOYMENT_TARGET", "10.9")
result = script_runner.run(
["delocate-wheel", whl_10_9, "--require-target-macos-version", "10.9"],
check=False,
Expand Down

0 comments on commit 0fd885d

Please sign in to comment.