dev-python/chardet: Enable py3.8, fix tests
authorMichał Górny <mgorny@gentoo.org>
Sat, 16 Nov 2019 13:26:24 +0000 (14:26 +0100)
committerMichał Górny <mgorny@gentoo.org>
Sat, 16 Nov 2019 13:29:20 +0000 (14:29 +0100)
Signed-off-by: Michał Górny <mgorny@gentoo.org>
dev-python/chardet/chardet-3.0.4.ebuild
dev-python/chardet/files/chardet-3.0.4-pytest-4.patch [new file with mode: 0644]

index c929783b3e229e7ef758453c103fb96c4f19b828..6dce19acd095cb0fe0262621060b214595e9d371 100644 (file)
@@ -3,7 +3,7 @@
 
 EAPI=6
 
-PYTHON_COMPAT=( python2_7 python3_{5,6,7} pypy pypy3 )
+PYTHON_COMPAT=( python2_7 python3_{5,6,7,8} pypy pypy3 )
 
 inherit distutils-r1
 
@@ -17,20 +17,14 @@ SRC_URI="https://github.com/chardet/chardet/archive/${PV}.tar.gz -> ${P}.tar.gz"
 LICENSE="LGPL-2.1"
 SLOT="0"
 KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 s390 ~sh sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~x64-solaris"
-IUSE="test"
-RESTRICT="!test? ( test )"
-
-RDEPEND="
-       dev-python/setuptools[${PYTHON_USEDEP}]
-"
 
+RDEPEND="dev-python/setuptools[${PYTHON_USEDEP}]"
 DEPEND="${RDEPEND}
-       test? (
-               dev-python/pytest[${PYTHON_USEDEP}]
-               dev-python/hypothesis[${PYTHON_USEDEP}]
-       )
+       test? ( dev-python/hypothesis[${PYTHON_USEDEP}] )
 "
 
-python_test() {
-       py.test -v || die "Tests fail with ${EPYTHON}"
-}
+PATCHES=(
+       "${FILESDIR}"/${P}-pytest-4.patch
+)
+
+distutils_enable_tests pytest
diff --git a/dev-python/chardet/files/chardet-3.0.4-pytest-4.patch b/dev-python/chardet/files/chardet-3.0.4-pytest-4.patch
new file mode 100644 (file)
index 0000000..eef88e9
--- /dev/null
@@ -0,0 +1,23 @@
+From 0561ddcedcd12ea1f98b7ddedb93686ed8a5ffa4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
+Date: Tue, 12 Mar 2019 18:44:36 +0100
+Subject: [PATCH] Support pytest 4, don't apply marks directly to parameters
+
+Fixes https://github.com/chardet/chardet/issues/173
+---
+ test.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/test.py b/test.py
+index 9833307..ad2b753 100644
+--- a/test.py
++++ b/test.py
+@@ -59,7 +59,7 @@ def gen_test_params():
+             full_path = join(path, file_name)
+             test_case = full_path, encoding
+             if full_path in EXPECTED_FAILURES:
+-                test_case = pytest.mark.xfail(test_case)
++                test_case = pytest.param(*test_case, marks=pytest.mark.xfail)
+             yield test_case