File: test_wheel.py

package info (click to toggle)
pdm-backend 2.4.5%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,124 kB
  • sloc: python: 2,833; ansic: 21; makefile: 5; sh: 1
file content (38 lines) | stat: -rw-r--r-- 1,176 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
import sys
from pathlib import Path

import pytest

from pdm.backend import wheel
from tests import FIXTURES


@pytest.mark.skipif(hasattr(sys, "pypy_version_info"), reason="invalid on PyPy3")
@pytest.mark.parametrize(
    "python_tag, py_limited_api, plat_name, tag",
    [
        ("cp36", "abi3", "win_amd64", "cp36-abi3-win_amd64"),
        ("py3", "none", "win_amd64", "py3-none-win_amd64"),
    ],
)
def test_override_tags_in_wheel_filename(
    python_tag: str, py_limited_api: str, plat_name: str, tag: str
) -> None:
    project = FIXTURES / "projects/demo-cextension"
    with wheel.WheelBuilder(
        project,
        config_settings={
            "--python-tag": python_tag,
            "--py-limited-api": py_limited_api,
            "--plat-name": plat_name,
        },
    ) as builder:
        assert builder.tag == tag


def test_dist_info_name_with_no_version(tmp_path: Path) -> None:
    project = FIXTURES / "projects/demo-no-version"
    with wheel.WheelBuilder(project) as builder:
        builder.initialize(builder.build_context(tmp_path))
        assert builder.dist_info_name == "demo-0.0.0.dist-info"
        assert builder.tag == "py3-none-any"