File: test_init.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 (37 lines) | stat: -rw-r--r-- 802 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
import importlib.util

import pytest

from streamlink.exceptions import StreamlinkDeprecationWarning


@pytest.mark.parametrize(
    "attr",
    [
        "LRUCache",
        "search_dict",
        "load_module",
        "NamedPipe",
        "parse_html",
        "parse_json",
        "parse_qsd",
        "parse_xml",
        "absolute_url",
        "prepend_www",
        "update_qsd",
        "update_scheme",
        "url_concat",
        "url_equal",
    ],
)
def test_deprecated(attr: str):
    spec = importlib.util.find_spec("streamlink.utils", "streamlink")
    assert spec
    assert spec.loader
    module = importlib.util.module_from_spec(spec)
    spec.loader.exec_module(module)

    with pytest.warns(StreamlinkDeprecationWarning):
        item = getattr(module, attr)

    assert item