File: test_output_stream_passthrough.py

package info (click to toggle)
streamlink 8.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,568 kB
  • sloc: python: 51,299; sh: 184; makefile: 152
file content (37 lines) | stat: -rw-r--r-- 983 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
from __future__ import annotations

import re
from pathlib import Path
from typing import TYPE_CHECKING

import pytest

import streamlink_cli.main
import tests


if TYPE_CHECKING:
    from streamlink.session import Streamlink


@pytest.fixture(autouse=True)
def session(session: Streamlink):
    session.plugins.load_path(Path(tests.__path__[0]) / "plugin")

    return session


@pytest.mark.parametrize(
    "argv",
    [pytest.param(["--player-passthrough=hls", "http://test.se", "hls"], id="no-player")],
    indirect=["argv"],
)
def test_no_player(monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str], argv: list):
    monkeypatch.setattr("streamlink_cli.argparser.find_default_player", lambda *_, **__: None)

    with pytest.raises(SystemExit) as exc_info:
        streamlink_cli.main.main()
    assert exc_info.value.code == 1

    out, _err = capsys.readouterr()
    assert re.search(r"error: The default player \(\w+\) does not seem to be installed\.", out)