File: test_AppPackagesMergeMixin__find_binary_packages.py

package info (click to toggle)
python-briefcase 0.3.25-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,596 kB
  • sloc: python: 62,519; makefile: 60
file content (116 lines) | stat: -rw-r--r-- 3,409 bytes parent folder | download | duplicates (2)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
from ...utils import create_installed_package


def test_find_binary_packages(dummy_command, tmp_path):
    """Binary packages can be identified in a app-packages folder."""

    create_installed_package(
        tmp_path / "app-packages",
        "pure-package1",
        version="1.2.3",
    )
    create_installed_package(
        tmp_path / "app-packages",
        "pure-package2",
        version="1.2.4",
    )
    create_installed_package(
        tmp_path / "app-packages",
        "universal-package-1",
        version="2.3.4",
        tag="macOS_11_universal2",
    )
    create_installed_package(
        tmp_path / "app-packages",
        "universal-package-2",
        version="2.3.5",
        tag="macOS_13_universal2",
    )
    create_installed_package(
        tmp_path / "app-packages",
        "binary-package-1",
        version="3.4.5",
        tag="macOS_11_arm64",
    )
    create_installed_package(
        tmp_path / "app-packages",
        "binary-package-2",
        version="3.4.6",
        tag="macOS_13_arm64",
        extra_content=[
            # A vendored, but incomplete .dist-info folder. See #1970
            ("vendored/nested-incomplete.dist-info/LICENSE", "Nested License", 0o644),
        ],
    )
    # A vendored .dist-info folder. This *isn't* found and processed.
    create_installed_package(
        tmp_path / "app-packages/binary-package-2/vendored",
        "nested-package",
        version="9.9.9",
        tag="macOS_13_arm64",
    )

    binary_packages = dummy_command.find_binary_packages(
        tmp_path / "app-packages",
        universal_suffix="_universal2",
    )

    # Binary wheels are discovered. We don't care about the order they are returned in,
    # just that they're all found.
    assert len(binary_packages) == 2
    assert set(binary_packages) == {
        ("binary-package-1", "3.4.5"),
        ("binary-package-2", "3.4.6"),
    }


def test_find_binary_packages_non_universal(dummy_command, tmp_path):
    """If no universal wheel format is specified, universal wheels are identified as
    binary."""

    create_installed_package(
        tmp_path / "app-packages",
        "pure-package1",
        version="1.2.3",
    )
    create_installed_package(
        tmp_path / "app-packages",
        "pure-package2",
        version="1.2.4",
    )
    create_installed_package(
        tmp_path / "app-packages",
        "universal-package-1",
        version="2.3.4",
        tag="macOS_11_universal2",
    )
    create_installed_package(
        tmp_path / "app-packages",
        "universal-package-2",
        version="2.3.5",
        tag="macOS_13_universal2",
    )
    create_installed_package(
        tmp_path / "app-packages",
        "binary-package-1",
        version="3.4.5",
        tag="macOS_11_arm64",
    )
    create_installed_package(
        tmp_path / "app-packages",
        "binary-package-2",
        version="3.4.6",
        tag="macOS_13_arm64",
    )

    binary_packages = dummy_command.find_binary_packages(tmp_path / "app-packages")

    # Binary wheels are discovered. We don't care about the order they are returned in,
    # just that they're all found.
    assert len(binary_packages) == 4
    assert set(binary_packages) == {
        ("universal-package-1", "2.3.4"),
        ("universal-package-2", "2.3.5"),
        ("binary-package-1", "3.4.5"),
        ("binary-package-2", "3.4.6"),
    }