diff options
author | Sam James <sam@gentoo.org> | 2024-04-14 12:08:59 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2024-04-14 12:09:36 +0100 |
commit | 8ecf6088682ea90c50f52e841a4ee404370b4460 (patch) | |
tree | 3d6ac66a9498accea4afac330ec517be97eeb3e5 /net-misc | |
parent | profiles/arch/x86: remove obsolete dev-util/clion mask (diff) | |
download | gentoo-8ecf6088682ea90c50f52e841a4ee404370b4460.tar.gz gentoo-8ecf6088682ea90c50f52e841a4ee404370b4460.tar.bz2 gentoo-8ecf6088682ea90c50f52e841a4ee404370b4460.zip |
net-misc/streamlink: fix tests w/ newer Python
Revbump as it fixes runtime behaviour too.
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'net-misc')
-rw-r--r-- | net-misc/streamlink/files/streamlink-6.7.2-validator.patch | 61 | ||||
-rw-r--r-- | net-misc/streamlink/streamlink-6.7.2-r1.ebuild | 102 |
2 files changed, 163 insertions, 0 deletions
diff --git a/net-misc/streamlink/files/streamlink-6.7.2-validator.patch b/net-misc/streamlink/files/streamlink-6.7.2-validator.patch new file mode 100644 index 000000000000..8dc69d62616a --- /dev/null +++ b/net-misc/streamlink/files/streamlink-6.7.2-validator.patch @@ -0,0 +1,61 @@ +https://github.com/streamlink/streamlink/pull/5932 +https://github.com/streamlink/streamlink/commit/0466622dc0bd13db972f6a00d2e2bda31ad50229 + +Quoting the PR: +""" +Since Python 3.11.9 / 3.12.3 / 3.13.0a6, urllib.parse.parse_qsl() now raises a TypeError +if the input is not a str, is truthy and can't be passed to memoryview(), like integers for example, +hence the test failure which previously just checked an invalid input to that validation schema. +""" + +From 51c13ddd45f83384cf7800a881127ad74dec3bb8 Mon Sep 17 00:00:00 2001 +From: bastimeyer <mail@bastimeyer.de> +Date: Tue, 9 Apr 2024 21:36:03 +0200 +Subject: [PATCH] plugin.api.validate: check parse_qsd() input type + +--- + src/streamlink/plugin/api/validate/_validators.py | 6 +++++- + tests/test_api_validate.py | 11 +++++++++-- + 2 files changed, 14 insertions(+), 3 deletions(-) + +diff --git a/src/streamlink/plugin/api/validate/_validators.py b/src/streamlink/plugin/api/validate/_validators.py +index 69135b74919..e99d305733f 100644 +--- a/src/streamlink/plugin/api/validate/_validators.py ++++ b/src/streamlink/plugin/api/validate/_validators.py +@@ -651,4 +651,8 @@ def validator_parse_qsd(*args, **kwargs) -> TransformSchema: + :raise ValidationError: On parsing error + """ + +- return TransformSchema(_parse_qsd, *args, **kwargs, exception=ValidationError, schema=None) ++ def parser(*_args, **_kwargs): ++ validate(AnySchema(str, bytes), _args[0]) ++ return _parse_qsd(*_args, **_kwargs, exception=ValidationError, schema=None) ++ ++ return TransformSchema(parser, *args, **kwargs) +diff --git a/tests/test_api_validate.py b/tests/test_api_validate.py +index ceff9bc1dde..c328116d27b 100644 +--- a/tests/test_api_validate.py ++++ b/tests/test_api_validate.py +@@ -1343,13 +1343,20 @@ def test_success(self): + validate.parse_qsd(), + "foo=bar&foo=baz&qux=quux", + ) == {"foo": "baz", "qux": "quux"} ++ assert validate.validate( ++ validate.parse_qsd(), ++ b"foo=bar&foo=baz&qux=quux", ++ ) == {b"foo": b"baz", b"qux": b"quux"} + + def test_failure(self): + with pytest.raises(ValidationError) as cm: + validate.validate(validate.parse_qsd(), 123) + assert_validationerror(cm.value, """ +- ValidationError: +- Unable to parse query string: 'int' object has no attribute 'decode' (123) ++ ValidationError(AnySchema): ++ ValidationError(type): ++ Type of 123 should be str, but is int ++ ValidationError(type): ++ Type of 123 should be bytes, but is int + """) + + diff --git a/net-misc/streamlink/streamlink-6.7.2-r1.ebuild b/net-misc/streamlink/streamlink-6.7.2-r1.ebuild new file mode 100644 index 000000000000..2f0f40037611 --- /dev/null +++ b/net-misc/streamlink/streamlink-6.7.2-r1.ebuild @@ -0,0 +1,102 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +if [[ ${PV} = 9999* ]]; then + EGIT_REPO_URI="https://github.com/streamlink/${PN}.git" + inherit git-r3 +fi + +DISTUTILS_SINGLE_IMPL=1 +# >= 6.2.1 uses a bunch of setuptools hooks instead of vanilla setuptools +# https://github.com/streamlink/streamlink/commit/194d9bc193f5285bc1ba33af5fd89209a96ad3a7 +DISTUTILS_USE_PEP517=standalone +PYTHON_COMPAT=( python3_{10..12} ) +PYTHON_REQ_USE='xml(+),threads(+)' +inherit distutils-r1 + +DESCRIPTION="CLI for extracting streams from websites to a video player of your choice" +HOMEPAGE="https://streamlink.github.io/" + +if [[ ${PV} != 9999* ]]; then + SRC_URI="https://github.com/streamlink/${PN}/releases/download/${PV}/${P}.tar.gz" +fi + +LICENSE="BSD-2 Apache-2.0" +SLOT="0" +if [[ ${PV} != 9999* ]]; then + KEYWORDS="~amd64 ~arm ~arm64 ~x86" +fi + +# See https://github.com/streamlink/streamlink/commit/9d8156dd794ee0919297cd90d85bcc11b8a28358 for chardet/charset-normalizer dep +# See https://github.com/streamlink/streamlink/pull/5895 re exceptiongroup dep +RDEPEND=" + media-video/ffmpeg + $(python_gen_cond_dep ' + dev-python/certifi[${PYTHON_USEDEP}] + || ( + dev-python/chardet[${PYTHON_USEDEP}] + dev-python/charset-normalizer[${PYTHON_USEDEP}] + ) + dev-python/exceptiongroup[${PYTHON_USEDEP}] + >=dev-python/requests-2.26.0[${PYTHON_USEDEP}] + dev-python/isodate[${PYTHON_USEDEP}] + >=dev-python/lxml-4.6.4[${PYTHON_USEDEP}] + >=dev-python/websocket-client-1.2.1[${PYTHON_USEDEP}] + dev-python/pycountry[${PYTHON_USEDEP}] + >=dev-python/pycryptodome-3.4.3[${PYTHON_USEDEP}] + >dev-python/PySocks-1.5.7[${PYTHON_USEDEP}] + >=dev-python/trio-0.22.0[${PYTHON_USEDEP}] + >=dev-python/trio-websocket-0.9.0[${PYTHON_USEDEP}] + >=dev-python/urllib3-1.26.0[${PYTHON_USEDEP}] + ') +" +BDEPEND=" + $(python_gen_cond_dep ' + >=dev-python/setuptools-64[${PYTHON_USEDEP}] + >=dev-python/versioningit-2.0.0[${PYTHON_USEDEP}] + test? ( + >=dev-python/freezegun-1.0.0[${PYTHON_USEDEP}] + dev-python/pytest-asyncio[${PYTHON_USEDEP}] + dev-python/pytest-trio[${PYTHON_USEDEP}] + dev-python/requests-mock[${PYTHON_USEDEP}] + ) + ') +" + +if [[ ${PV} == 9999* ]]; then + RDEPEND+=" + $(python_gen_cond_dep ' + >=dev-python/versioningit-2.0.0[${PYTHON_USEDEP}] + ') + " +fi + +PATCHES=( + "${FILESDIR}"/${P}-validator.patch +) + +distutils_enable_tests pytest + +python_test() { + # Skip tests requiring <dev-python/pytest-8.0.0 which is currently masked + # https://github.com/streamlink/streamlink/pull/5901 + EPYTEST_DESELECT+=( + tests/webbrowser/cdp/test_client.py::TestEvaluate::test_exception + tests/webbrowser/cdp/test_client.py::TestEvaluate::test_error + tests/webbrowser/cdp/test_client.py::TestNavigate::test_detach + tests/webbrowser/cdp/test_client.py::TestNavigate::test_error + tests/webbrowser/cdp/test_connection.py::TestCreateConnection::test_failure + tests/webbrowser/cdp/test_connection.py::TestReaderError::test_invalid_json + tests/webbrowser/cdp/test_connection.py::TestReaderError::test_unknown_session_id + 'tests/webbrowser/cdp/test_connection.py::TestSend::test_timeout[Default timeout, response not in time]' + 'tests/webbrowser/cdp/test_connection.py::TestSend::test_timeout[Custom timeout, response not in time]' + tests/webbrowser/cdp/test_connection.py::TestSend::test_bad_command + tests/webbrowser/cdp/test_connection.py::TestSend::test_result_exception + tests/webbrowser/cdp/test_connection.py::TestHandleCmdResponse::test_response_error + tests/webbrowser/cdp/test_connection.py::TestHandleCmdResponse::test_response_no_result + ) + + epytest +} |