1 |
commit: d01ba0dfc653ab48b4b2b95eb6ca5671901737c8 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jul 5 09:49:08 2021 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jul 5 09:49:51 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d01ba0df |
7 |
|
8 |
dev-python/testtools: Eliminate unittest2 |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
.../files/testtools-2.4.0-assertitemsequal.patch | 27 +++++++++++ |
13 |
dev-python/testtools/testtools-2.4.0-r2.ebuild | 55 ++++++++++++++++++++++ |
14 |
2 files changed, 82 insertions(+) |
15 |
|
16 |
diff --git a/dev-python/testtools/files/testtools-2.4.0-assertitemsequal.patch b/dev-python/testtools/files/testtools-2.4.0-assertitemsequal.patch |
17 |
new file mode 100644 |
18 |
index 00000000000..e46bf29c8bf |
19 |
--- /dev/null |
20 |
+++ b/dev-python/testtools/files/testtools-2.4.0-assertitemsequal.patch |
21 |
@@ -0,0 +1,27 @@ |
22 |
+From 2ead7c11a54b0860e02992212e302c4a7bd26c35 Mon Sep 17 00:00:00 2001 |
23 |
+From: Matthew Treinish <mtreinish@××××××.org> |
24 |
+Date: Wed, 8 Jul 2020 14:22:24 -0400 |
25 |
+Subject: [PATCH] Update testtools/testcase.py |
26 |
+ |
27 |
+Co-authored-by: Thomas Grainger <tagrain@×××××.com> |
28 |
+--- |
29 |
+ testtools/testcase.py | 1 + |
30 |
+ 1 file changed, 1 insertion(+) |
31 |
+ |
32 |
+Rebased for 2.4.0 by Michał Górny (eliminating intermediate commits). |
33 |
+ |
34 |
+diff --git a/testtools/testcase.py b/testtools/testcase.py |
35 |
+index bff5be2..22e9143 100644 |
36 |
+--- a/testtools/testcase.py |
37 |
++++ b/testtools/testcase.py |
38 |
+@@ -501,6 +501,7 @@ class TestCase(unittest.TestCase): |
39 |
+ if mismatch_error is not None: |
40 |
+ raise mismatch_error |
41 |
+ |
42 |
++ assertItemsEqual = unittest.TestCase.assertCountEqual |
43 |
+ def addDetailUniqueName(self, name, content_object): |
44 |
+ """Add a detail to the test, but ensure it's name is unique. |
45 |
+ |
46 |
+-- |
47 |
+2.32.0 |
48 |
+ |
49 |
|
50 |
diff --git a/dev-python/testtools/testtools-2.4.0-r2.ebuild b/dev-python/testtools/testtools-2.4.0-r2.ebuild |
51 |
new file mode 100644 |
52 |
index 00000000000..d95f4dfff00 |
53 |
--- /dev/null |
54 |
+++ b/dev-python/testtools/testtools-2.4.0-r2.ebuild |
55 |
@@ -0,0 +1,55 @@ |
56 |
+# Copyright 1999-2021 Gentoo Authors |
57 |
+# Distributed under the terms of the GNU General Public License v2 |
58 |
+ |
59 |
+EAPI=8 |
60 |
+ |
61 |
+PYTHON_COMPAT=( python3_{8..9} pypy3 ) |
62 |
+PYTHON_REQ_USE="threads(+)" |
63 |
+ |
64 |
+inherit distutils-r1 |
65 |
+ |
66 |
+DESCRIPTION="Extensions to the Python standard library unit testing framework" |
67 |
+HOMEPAGE="https://github.com/testing-cabal/testtools" |
68 |
+SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz" |
69 |
+ |
70 |
+LICENSE="MIT" |
71 |
+SLOT="0" |
72 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos" |
73 |
+ |
74 |
+RDEPEND=" |
75 |
+ >=dev-python/extras-1.0.0[${PYTHON_USEDEP}] |
76 |
+ dev-python/python-mimeparse[${PYTHON_USEDEP}] |
77 |
+ >=dev-python/pbr-0.11[${PYTHON_USEDEP}] |
78 |
+ dev-python/pyrsistent[${PYTHON_USEDEP}] |
79 |
+ >=dev-python/six-1.4.0[${PYTHON_USEDEP}] |
80 |
+ dev-python/traceback2[${PYTHON_USEDEP}] |
81 |
+" |
82 |
+DEPEND=" |
83 |
+ test? ( |
84 |
+ >=dev-python/fixtures-1.3.0[${PYTHON_USEDEP}] |
85 |
+ dev-python/testscenarios[${PYTHON_USEDEP}] |
86 |
+ ) |
87 |
+" |
88 |
+PDEPEND=">=dev-python/fixtures-1.3.0[${PYTHON_USEDEP}]" |
89 |
+ |
90 |
+PATCHES=( |
91 |
+ "${FILESDIR}"/testtools-2.4.0-py39.patch |
92 |
+ "${FILESDIR}"/testtools-2.4.0-assertitemsequal.patch |
93 |
+) |
94 |
+ |
95 |
+distutils_enable_sphinx doc |
96 |
+distutils_enable_tests unittest |
97 |
+ |
98 |
+src_prepare() { |
99 |
+ # eliminate unittest2 |
100 |
+ sed -i -e '/unittest2/d' requirements.txt || die |
101 |
+ # also conditional imports |
102 |
+ find -name '*.py' -exec \ |
103 |
+ sed -i -e 's:unittest2:unittest:' {} + || die |
104 |
+ distutils-r1_src_prepare |
105 |
+} |
106 |
+ |
107 |
+python_test() { |
108 |
+ "${PYTHON}" -m testtools.run testtools.tests.test_suite || |
109 |
+ die "tests failed under ${EPYTHON}" |
110 |
+} |