commit:     d01ba0dfc653ab48b4b2b95eb6ca5671901737c8
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Jul  5 09:49:08 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Jul  5 09:49:51 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d01ba0df

dev-python/testtools: Eliminate unittest2

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../files/testtools-2.4.0-assertitemsequal.patch   | 27 +++++++++++
 dev-python/testtools/testtools-2.4.0-r2.ebuild     | 55 ++++++++++++++++++++++
 2 files changed, 82 insertions(+)

diff --git a/dev-python/testtools/files/testtools-2.4.0-assertitemsequal.patch 
b/dev-python/testtools/files/testtools-2.4.0-assertitemsequal.patch
new file mode 100644
index 00000000000..e46bf29c8bf
--- /dev/null
+++ b/dev-python/testtools/files/testtools-2.4.0-assertitemsequal.patch
@@ -0,0 +1,27 @@
+From 2ead7c11a54b0860e02992212e302c4a7bd26c35 Mon Sep 17 00:00:00 2001
+From: Matthew Treinish <[email protected]>
+Date: Wed, 8 Jul 2020 14:22:24 -0400
+Subject: [PATCH] Update testtools/testcase.py
+
+Co-authored-by: Thomas Grainger <[email protected]>
+---
+ testtools/testcase.py | 1 +
+ 1 file changed, 1 insertion(+)
+
+Rebased for 2.4.0 by Michał Górny (eliminating intermediate commits).
+
+diff --git a/testtools/testcase.py b/testtools/testcase.py
+index bff5be2..22e9143 100644
+--- a/testtools/testcase.py
++++ b/testtools/testcase.py
+@@ -501,6 +501,7 @@ class TestCase(unittest.TestCase):
+         if mismatch_error is not None:
+             raise mismatch_error
+ 
++    assertItemsEqual = unittest.TestCase.assertCountEqual
+     def addDetailUniqueName(self, name, content_object):
+         """Add a detail to the test, but ensure it's name is unique.
+ 
+-- 
+2.32.0
+

diff --git a/dev-python/testtools/testtools-2.4.0-r2.ebuild 
b/dev-python/testtools/testtools-2.4.0-r2.ebuild
new file mode 100644
index 00000000000..d95f4dfff00
--- /dev/null
+++ b/dev-python/testtools/testtools-2.4.0-r2.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{8..9} pypy3 )
+PYTHON_REQ_USE="threads(+)"
+
+inherit distutils-r1
+
+DESCRIPTION="Extensions to the Python standard library unit testing framework"
+HOMEPAGE="https://github.com/testing-cabal/testtools";
+SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv 
~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos"
+
+RDEPEND="
+       >=dev-python/extras-1.0.0[${PYTHON_USEDEP}]
+       dev-python/python-mimeparse[${PYTHON_USEDEP}]
+       >=dev-python/pbr-0.11[${PYTHON_USEDEP}]
+       dev-python/pyrsistent[${PYTHON_USEDEP}]
+       >=dev-python/six-1.4.0[${PYTHON_USEDEP}]
+       dev-python/traceback2[${PYTHON_USEDEP}]
+"
+DEPEND="
+       test? (
+               >=dev-python/fixtures-1.3.0[${PYTHON_USEDEP}]
+               dev-python/testscenarios[${PYTHON_USEDEP}]
+       )
+"
+PDEPEND=">=dev-python/fixtures-1.3.0[${PYTHON_USEDEP}]"
+
+PATCHES=(
+       "${FILESDIR}"/testtools-2.4.0-py39.patch
+       "${FILESDIR}"/testtools-2.4.0-assertitemsequal.patch
+)
+
+distutils_enable_sphinx doc
+distutils_enable_tests unittest
+
+src_prepare() {
+       # eliminate unittest2
+       sed -i -e '/unittest2/d' requirements.txt || die
+       # also conditional imports
+       find -name '*.py' -exec \
+               sed -i -e 's:unittest2:unittest:' {} + || die
+       distutils-r1_src_prepare
+}
+
+python_test() {
+       "${PYTHON}" -m testtools.run testtools.tests.test_suite ||
+               die "tests failed under ${EPYTHON}"
+}

Reply via email to