blob: ae584af0d901552ea277a4271a029229db786ea3 (
plain)
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
29
30
31
32
33
34
35
36
|
from __future__ import annotations
import platform
import stat
import pytest
from wheel.cli.unpack import unpack
from wheel.wheelfile import WheelFile
def test_unpack(wheel_paths, tmp_path):
"""
Make sure 'wheel unpack' works.
This also verifies the integrity of our testing wheel files.
"""
for wheel_path in wheel_paths:
unpack(wheel_path, str(tmp_path))
@pytest.mark.skipif(
platform.system() == "Windows", reason="Windows does not support the executable bit"
)
def test_unpack_executable_bit(tmp_path):
wheel_path = tmp_path / "test-1.0-py3-none-any.whl"
script_path = tmp_path / "script"
script_path.write_bytes(b"test script")
script_path.chmod(0o755)
with WheelFile(wheel_path, "w") as wf:
wf.write(str(script_path), "nested/script")
script_path.unlink()
script_path = tmp_path / "test-1.0" / "nested" / "script"
unpack(str(wheel_path), str(tmp_path))
assert not script_path.is_dir()
assert stat.S_IMODE(script_path.stat().st_mode) == 0o755
|