commit:     c4609b3c6ac91e08a2cc68477400259543637352
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat May 17 14:46:01 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat May 17 15:03:33 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c4609b3c

dev-python/testtools: enable py3.14

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../testtools/files/testtools-2.7.2-py314.patch    | 34 +++++++++++++++
 dev-python/testtools/testtools-2.7.2-r1.ebuild     | 49 ++++++++++++++++++++++
 2 files changed, 83 insertions(+)

diff --git a/dev-python/testtools/files/testtools-2.7.2-py314.patch 
b/dev-python/testtools/files/testtools-2.7.2-py314.patch
new file mode 100644
index 000000000000..afce3b2c12ad
--- /dev/null
+++ b/dev-python/testtools/files/testtools-2.7.2-py314.patch
@@ -0,0 +1,34 @@
+https://github.com/testing-cabal/testtools/commit/79fa5d41a05c423cf43a65d2b347c7c566bcdfa5
+
+From 79fa5d41a05c423cf43a65d2b347c7c566bcdfa5 Mon Sep 17 00:00:00 2001
+From: Stephen Finucane <[email protected]>
+Date: Fri, 21 Feb 2025 11:14:35 +0000
+Subject: [PATCH] Resolve deprecation warning
+
+See [1] for more info.
+
+[1] https://github.com/python/cpython/issues/79893
+
+Signed-off-by: Stephen Finucane <[email protected]>
+---
+ testtools/testcase.py | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/testtools/testcase.py b/testtools/testcase.py
+index ad983730..4f4923b3 100644
+--- a/testtools/testcase.py
++++ b/testtools/testcase.py
+@@ -268,8 +268,10 @@ def _reset(self):
+ 
+     def __eq__(self, other):
+         eq = getattr(unittest.TestCase, "__eq__", None)
+-        if eq is not None and not unittest.TestCase.__eq__(self, other):
+-            return False
++        if eq is not None:
++            eq_ = unittest.TestCase.__eq__(self, other)
++            if eq_ is NotImplemented or not eq_:
++                return False
+         return self.__dict__ == getattr(other, "__dict__", None)
+ 
+     # We need to explicitly set this since we're overriding __eq__
+

diff --git a/dev-python/testtools/testtools-2.7.2-r1.ebuild 
b/dev-python/testtools/testtools-2.7.2-r1.ebuild
new file mode 100644
index 000000000000..8805ed297909
--- /dev/null
+++ b/dev-python/testtools/testtools-2.7.2-r1.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=hatchling
+PYTHON_COMPAT=( python3_{11..14} pypy3_11 )
+PYTHON_REQ_USE="threads(+)"
+
+inherit distutils-r1 pypi
+
+DESCRIPTION="Extensions to the Python standard library unit testing framework"
+HOMEPAGE="
+       https://github.com/testing-cabal/testtools/
+       https://pypi.org/project/testtools/
+"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+BDEPEND="
+       dev-python/hatch-vcs[${PYTHON_USEDEP}]
+       test? (
+               >=dev-python/fixtures-2.0.0[${PYTHON_USEDEP}]
+               dev-python/testscenarios[${PYTHON_USEDEP}]
+               dev-python/testresources[${PYTHON_USEDEP}]
+               dev-python/twisted[${PYTHON_USEDEP}]
+       )
+"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-2.7.2-twisted-fix.patch"
+       "${FILESDIR}/${PN}-2.7.2-py314.patch"
+)
+
+distutils_enable_sphinx doc
+
+python_test() {
+       cp testtools/tests/__init__.py test_suite.py || die
+       if ! has_version "dev-python/twisted[${PYTHON_USEDEP}]"; then
+               sed -i -e '/twistedsupport/d' test_suite.py || die
+       fi
+
+       "${EPYTHON}" -m testtools.run test_suite.test_suite ||
+               die "tests failed under ${EPYTHON}"
+}

Reply via email to