summaryrefslogtreecommitdiff
path: root/dev-python/testtools
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/testtools')
-rw-r--r--dev-python/testtools/Manifest3
-rw-r--r--dev-python/testtools/files/testtools-2.7.2-py314.patch34
-rw-r--r--dev-python/testtools/files/testtools-2.7.2-twisted-fix.patch45
-rw-r--r--dev-python/testtools/metadata.xml17
-rw-r--r--dev-python/testtools/testtools-2.7.2-r1.ebuild49
-rw-r--r--dev-python/testtools/testtools-2.9.1.ebuild44
6 files changed, 192 insertions, 0 deletions
diff --git a/dev-python/testtools/Manifest b/dev-python/testtools/Manifest
new file mode 100644
index 000000000000..9dc319250ddb
--- /dev/null
+++ b/dev-python/testtools/Manifest
@@ -0,0 +1,3 @@
+DIST testtools-2.7.2.tar.gz 201430 BLAKE2B d827d8e66c85908f4d16aa0762c3b0a454d374a0d23323fc3c123027f55f0e85f4fea9a24b5d1d0279266af2185f08abbcbbdcb785014b237df45a6448587611 SHA512 5815519d2b72d6b1e9f453c02793c70eb7d3b6580a211fb3708cd6121aed3c6100ceb1e35321f481a63b1f999ede030e43f1ae91d3621faf461c1908db767551
+DIST testtools-2.9.1.tar.gz 221377 BLAKE2B 61684837047dc9ec91a412b22f7423c43f19500062571d0b36f821576503537218f5225c963f603feb142e3f1a5766d825a59df8e6a5da12d739372ae7c55b85 SHA512 68530c96756d383575602c6e3b6d33ca19fec4fe35ac6dba4ada4954be969a31414f930572cebbcbe4008fbdd1904537be793acdb5cce8458e36cdcbbfe719e0
+DIST testtools-2.9.1.tar.gz.provenance 9604 BLAKE2B 01f82b392b2dd0226fda576aefd788c388ba50c275740f4adeab5ad2decf56a6a628e911bb8db0423ef047bf845325759f8c5c3135abd8146a33e4e699fa92c6 SHA512 5177b6070f4760baffc1644536abea1de55937e797de08e8d499e7ce07053ce8e0c22d996e9401a53e2ebe2461ce0c32e50732cdd9af0a26e40b3e19aac8891e
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 <stephen@that.guru>
+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 <stephen@that.guru>
+---
+ 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/files/testtools-2.7.2-twisted-fix.patch b/dev-python/testtools/files/testtools-2.7.2-twisted-fix.patch
new file mode 100644
index 000000000000..bbf943be60d1
--- /dev/null
+++ b/dev-python/testtools/files/testtools-2.7.2-twisted-fix.patch
@@ -0,0 +1,45 @@
+From 5b8cb6497c7159f593e68de6a13e15f7e78e56e3 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20Van=C4=9Bk?= <arkamar@atlas.cz>
+Date: Mon, 1 Jul 2024 10:00:05 +0200
+Subject: [PATCH] Prepare tests for upcoming twisted version
+
+Twisted recently changed behavior of logger on failures [1]. It newly
+logs the `Main loop terminated.` even on exceptions, which breaks two
+test in twistedsupport test suite. This hack attempts to address the
+upcoming issue.
+
+[1] https://github.com/twisted/twisted/pull/12207
+
+Upstream-PR: https://github.com/testing-cabal/testtools/pull/387
+
+diff --git a/testtools/tests/twistedsupport/test_runtest.py b/testtools/tests/twistedsupport/test_runtest.py
+index 4b46cc64..f8faf7c6 100644
+--- a/testtools/tests/twistedsupport/test_runtest.py
++++ b/testtools/tests/twistedsupport/test_runtest.py
+@@ -16,7 +16,6 @@
+ Contains,
+ ContainsAll,
+ ContainsDict,
+- EndsWith,
+ Equals,
+ Is,
+ KeysEqual,
+@@ -749,7 +748,7 @@ def test_something(self):
+ test,
+ {
+ "traceback": Not(Is(None)),
+- "twisted-log": AsText(EndsWith(" foo\n")),
++ "twisted-log": AsText(Contains(" foo\n")),
+ },
+ ),
+ ("stopTest", test),
+@@ -790,7 +789,8 @@ def test_something(self):
+ result = self.make_result()
+ runner.run(result)
+ self.assertThat(
+- messages, MatchesListwise([ContainsDict({"message": Equals(("foo",))})])
++ messages[0:1],
++ MatchesListwise([ContainsDict({"message": Equals(("foo",))})]),
+ )
+
+ def test_restore_observers(self):
diff --git a/dev-python/testtools/metadata.xml b/dev-python/testtools/metadata.xml
new file mode 100644
index 000000000000..b06b5d256945
--- /dev/null
+++ b/dev-python/testtools/metadata.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://docs.baldeagleos.com/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>python@gentoo.org</email>
+ <name>Python</name>
+ </maintainer>
+ <maintainer type="project">
+ <email>openstack@gentoo.org</email>
+ <name>Openstack</name>
+ </maintainer>
+ <stabilize-allarches />
+ <upstream>
+ <remote-id type="launchpad">testtools</remote-id>
+ </upstream>
+ <origin>baldeagleos-repo</origin>
+</pkgmetadata>
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..4abb03a66fca
--- /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_{13..14} )
+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 ~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}"
+}
diff --git a/dev-python/testtools/testtools-2.9.1.ebuild b/dev-python/testtools/testtools-2.9.1.ebuild
new file mode 100644
index 000000000000..78f7159d6547
--- /dev/null
+++ b/dev-python/testtools/testtools-2.9.1.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=hatchling
+PYPI_VERIFY_REPO=https://github.com/testing-cabal/testtools
+PYTHON_COMPAT=( python3_{13..14} )
+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 ~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}]
+ )
+"
+
+distutils_enable_sphinx doc
+
+python_test() {
+ if ! has_version "dev-python/twisted[${PYTHON_USEDEP}]"; then
+ sed -i -e '/twistedsupport/d' tests/test_suite.py || die
+ fi
+
+ "${EPYTHON}" -m testtools.run tests.test_suite ||
+ die "tests failed under ${EPYTHON}"
+}