diff options
author | Ionen Wolkens <ionen@gentoo.org> | 2024-04-26 07:25:15 -0400 |
---|---|---|
committer | Ionen Wolkens <ionen@gentoo.org> | 2024-04-26 07:30:32 -0400 |
commit | ad94d2fe89249c6d7c7f8962668e409bcdfa464f (patch) | |
tree | 23e1a6b56f9a51910f9a31c5f6cf32f5a7088a11 /www-client/qutebrowser | |
parent | dev-python/PyQt6-WebEngine: add 6.7.0 (diff) | |
download | gentoo-ad94d2fe89249c6d7c7f8962668e409bcdfa464f.tar.gz gentoo-ad94d2fe89249c6d7c7f8962668e409bcdfa464f.tar.bz2 gentoo-ad94d2fe89249c6d7c7f8962668e409bcdfa464f.zip |
www-client/qutebrowser: backport tests fix for PyQt6-6.7.0
Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
Diffstat (limited to 'www-client/qutebrowser')
-rw-r--r-- | www-client/qutebrowser/files/qutebrowser-3.1.0-pyqt670-tests.patch | 73 | ||||
-rw-r--r-- | www-client/qutebrowser/qutebrowser-3.1.0-r1.ebuild | 1 |
2 files changed, 74 insertions, 0 deletions
diff --git a/www-client/qutebrowser/files/qutebrowser-3.1.0-pyqt670-tests.patch b/www-client/qutebrowser/files/qutebrowser-3.1.0-pyqt670-tests.patch new file mode 100644 index 000000000000..8095c3fa02ce --- /dev/null +++ b/www-client/qutebrowser/files/qutebrowser-3.1.0-pyqt670-tests.patch @@ -0,0 +1,73 @@ +https://github.com/qutebrowser/qutebrowser/commit/1ee138b681a590ee500954361eed2cf923b1d8a0 +From: Florian Bruhin <me@the-compiler.org> +Date: Mon, 25 Mar 2024 23:19:37 +0100 +Subject: [PATCH] qtutils: Handle QDataStream.Status.SizeLimitExceeded +--- a/qutebrowser/utils/qtutils.py ++++ b/qutebrowser/utils/qtutils.py +@@ -193,6 +193,15 @@ def check_qdatastream(stream: QDataStream) -> None: + QDataStream.Status.WriteFailed: ("The data stream cannot write to the " + "underlying device."), + } ++ try: ++ status_to_str[QDataStream.Status.SizeLimitExceeded] = ( # type: ignore[attr-defined] ++ "The data stream cannot read or write the data because its size is larger " ++ "than supported by the current platform." ++ ) ++ except AttributeError: ++ # Added in Qt 6.7 ++ pass ++ + if stream.status() != QDataStream.Status.Ok: + raise OSError(status_to_str[stream.status()]) + +--- a/tests/unit/utils/test_qtutils.py ++++ b/tests/unit/utils/test_qtutils.py +@@ -208,6 +208,18 @@ def test_ensure_valid(obj, raising, exc_reason, exc_str): + "The data stream has read corrupt data."), + (QDataStream.Status.WriteFailed, True, + "The data stream cannot write to the underlying device."), ++ pytest.param( ++ getattr(QDataStream.Status, "SizeLimitExceeded", None), ++ True, ++ ( ++ "The data stream cannot read or write the data because its size is larger " ++ "than supported by the current platform." ++ ), ++ marks=pytest.mark.skipif( ++ not hasattr(QDataStream.Status, "SizeLimitExceeded"), ++ reason="Added in Qt 6.7" ++ ) ++ ), + ]) + def test_check_qdatastream(status, raising, message): + """Test check_qdatastream. +@@ -226,10 +238,25 @@ def test_check_qdatastream(status, raising, message): + qtutils.check_qdatastream(stream) + + +-def test_qdatastream_status_count(): +- """Make sure no new members are added to QDataStream.Status.""" +- status_vals = testutils.enum_members(QDataStream, QDataStream.Status) +- assert len(status_vals) == 4 ++def test_qdatastream_status_members(): ++ """Make sure no new members are added to QDataStream.Status. ++ ++ If this fails, qtutils.check_qdatastream will need to be updated with the ++ respective error documentation. ++ """ ++ status_vals = set(testutils.enum_members(QDataStream, QDataStream.Status).values()) ++ expected = { ++ QDataStream.Status.Ok, ++ QDataStream.Status.ReadPastEnd, ++ QDataStream.Status.ReadCorruptData, ++ QDataStream.Status.WriteFailed, ++ } ++ try: ++ expected.add(QDataStream.Status.SizeLimitExceeded) ++ except AttributeError: ++ # Added in Qt 6.7 ++ pass ++ assert status_vals == expected + + + @pytest.mark.parametrize('color, expected', [ diff --git a/www-client/qutebrowser/qutebrowser-3.1.0-r1.ebuild b/www-client/qutebrowser/qutebrowser-3.1.0-r1.ebuild index f40f5009dff3..3eb916073966 100644 --- a/www-client/qutebrowser/qutebrowser-3.1.0-r1.ebuild +++ b/www-client/qutebrowser/qutebrowser-3.1.0-r1.ebuild @@ -83,6 +83,7 @@ distutils_enable_tests pytest PATCHES=( "${FILESDIR}"/${P}-qt663-tests.patch + "${FILESDIR}"/${P}-pyqt670-tests.patch ) src_prepare() { |