mirror of https://github.com/streamlink/streamlink
session: add plugins args from JSON in reverse
This commit is contained in:
parent
5e0e38afc2
commit
bf4ff71003
|
@ -317,7 +317,7 @@ class StreamlinkPluginsData:
|
|||
if not plugindata.get("arguments"):
|
||||
continue
|
||||
arguments = Arguments()
|
||||
for a in plugindata.get("arguments") or []:
|
||||
for a in reversed(plugindata.get("arguments") or []):
|
||||
if argument := cls._build_argument(a):
|
||||
arguments.add(argument)
|
||||
|
||||
|
|
|
@ -387,7 +387,13 @@ class TestLoadPluginsData:
|
|||
assert session.plugins.get_names() == ["empty", "testpluginA", "testpluginB"]
|
||||
assert [(record.name, record.levelname, record.message) for record in caplog.get_records(when="setup")] == []
|
||||
|
||||
# arguments are added in reverse order:
|
||||
# `Arguments` does this because of the reverse order of the @pluginargument decorator
|
||||
arguments_a = Arguments()
|
||||
arguments_a.add(Argument(
|
||||
name="bar",
|
||||
const="bar",
|
||||
))
|
||||
arguments_a.add(Argument(
|
||||
name="foo",
|
||||
action="store",
|
||||
|
@ -400,19 +406,15 @@ class TestLoadPluginsData:
|
|||
dest="oof",
|
||||
argument_name="oof",
|
||||
))
|
||||
arguments_a.add(Argument(
|
||||
name="bar",
|
||||
const="bar",
|
||||
))
|
||||
arguments_b = Arguments()
|
||||
arguments_b.add(Argument(
|
||||
name="bool",
|
||||
type=boolean,
|
||||
))
|
||||
arguments_b.add(Argument(
|
||||
name="cmf",
|
||||
type=comma_list_filter(["1", "2", "3"], unique=True),
|
||||
))
|
||||
arguments_b.add(Argument(
|
||||
name="bool",
|
||||
type=boolean,
|
||||
))
|
||||
assert list(session.plugins.iter_arguments()) == [("testpluginA", arguments_a), ("testpluginB", arguments_b)]
|
||||
|
||||
@pytest.mark.parametrize("pluginsdata", [
|
||||
|
|
Loading…
Reference in New Issue