File: test_build_backend.py

package info (click to toggle)
streamlink 8.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,608 kB
  • sloc: python: 51,763; sh: 184; makefile: 152
file content (44 lines) | stat: -rw-r--r-- 1,437 bytes parent folder | download | duplicates (4)
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
import pytest
from setuptools.command.egg_info import egg_info

from build_backend import _filter_cmd_option_args


@pytest.mark.parametrize(
    ("config_settings", "expected", "options"),
    [
        pytest.param(
            None,
            None,
            egg_info.user_options,
            id="Empty config_settings",
        ),
        pytest.param(
            {"foo": "bar"},
            {"foo": "bar"},
            egg_info.user_options,
            id="No --build-option key",
        ),
        pytest.param(
            {"--build-option": "--egg-base=foo/bar -e baz/qux --tag-build foo -b bar --tag-date --no-date -D"},
            {"--build-option": "--egg-base=foo/bar -e baz/qux --tag-build foo -b bar --tag-date --no-date -D"},
            egg_info.user_options,
            id="All egg_info options",
        ),
        pytest.param(
            {"--build-option": "--foo --bar --baz"},
            {},
            egg_info.user_options,
            id="Options unknown to egg_info",
        ),
        pytest.param(
            {"--build-option": "-p win32 --plat-name win32 --plat-name=win32"},
            {},
            egg_info.user_options,
            id="bdist_wheel --plat-name option",
        ),
    ],
)
def test_filter_cmd_option_args(config_settings: dict, expected: str, options: list):
    _filter_cmd_option_args(config_settings, "--build-option", options)
    assert config_settings == expected