mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-24 04:59:14 -07:00
dev-python/css-parser: enable py3.11
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
EAPI=8
|
||||
|
||||
DISTUTILS_USE_PEP517=setuptools
|
||||
PYTHON_COMPAT=( python3_{8..10} )
|
||||
PYTHON_COMPAT=( python3_{8..11} )
|
||||
|
||||
inherit distutils-r1
|
||||
|
||||
@@ -20,4 +20,8 @@ BDEPEND="
|
||||
test? ( dev-python/chardet[${PYTHON_USEDEP}] )
|
||||
"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${P}-python311-tests.patch
|
||||
)
|
||||
|
||||
distutils_enable_tests unittest
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
https://github.com/ebook-utils/css-parser/commit/ad79cfcb6e55837a4353b92d051de023c18f6581
|
||||
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Sat, 21 May 2022 14:21:28 +0200
|
||||
Subject: [PATCH] tests: adjust exception string checks for python 3.11
|
||||
|
||||
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2062102.
|
||||
--- a/css_parser_tests/test_property.py
|
||||
+++ b/css_parser_tests/test_property.py
|
||||
@@ -5,6 +5,7 @@
|
||||
import xml.dom
|
||||
from . import basetest
|
||||
import css_parser
|
||||
+import sys
|
||||
|
||||
|
||||
class PropertyTestCase(basetest.BaseTestCase):
|
||||
@@ -162,8 +163,9 @@ def test_literalname(self):
|
||||
"Property.literalname"
|
||||
p = css_parser.css.property.Property(r'c\olor', 'red')
|
||||
self.assertEqual(r'c\olor', p.literalname)
|
||||
- self.assertRaisesMsgSubstring(AttributeError, "can't set attribute", p.__setattr__,
|
||||
- 'literalname', 'color')
|
||||
+ pattern = "object has no setter" if sys.version_info >= (3,11) else "can't set attribute"
|
||||
+ self.assertRaisesMsgSubstring(AttributeError, pattern,
|
||||
+ p.__setattr__, 'literalname', 'color')
|
||||
|
||||
def test_validate(self):
|
||||
"Property.valid"
|
||||
--- a/css_parser_tests/test_selector.py
|
||||
+++ b/css_parser_tests/test_selector.py
|
||||
@@ -11,6 +11,7 @@
|
||||
import xml.dom
|
||||
from . import basetest
|
||||
import css_parser
|
||||
+import sys
|
||||
|
||||
|
||||
class SelectorTestCase(basetest.BaseTestCase):
|
||||
@@ -412,7 +413,9 @@ def test_specificity(self):
|
||||
|
||||
# readonly
|
||||
def _set(): selector.specificity = 1
|
||||
- self.assertRaisesMsgSubstring(AttributeError, "can't set attribute", _set)
|
||||
+
|
||||
+ pattern = "object has no setter" if sys.version_info >= (3,11) else "can't set attribute"
|
||||
+ self.assertRaisesMsgSubstring(AttributeError, pattern, _set)
|
||||
|
||||
tests = {
|
||||
'*': (0, 0, 0, 0),
|
||||
|
||||
Reference in New Issue
Block a user