aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2024-05-12 10:18:46 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2024-05-12 10:35:49 +0200
commitd0bf0a5afdba47490904959dc07d09a814d1300a (patch)
treebe8f339fe047cb76f41b6e0f634d9ca1b47b6e1a
parent8412c1e390abbbcc91aaa103be6b664d77044a8a (diff)
main/py3-testtools: fix compat with pytest 8.2HEADmaster
Fixes community/py3-stestr tests ref: https://github.com/pytest-dev/pytest/issues/12263#issuecomment-2081434468 ref: https://github.com/mtreinish/stestr/issues/363
-rw-r--r--main/py3-testtools/APKBUILD6
-rw-r--r--main/py3-testtools/pytest8.2.patch23
2 files changed, 27 insertions, 2 deletions
diff --git a/main/py3-testtools/APKBUILD b/main/py3-testtools/APKBUILD
index 594f01f0f41..ee7b952e7a8 100644
--- a/main/py3-testtools/APKBUILD
+++ b/main/py3-testtools/APKBUILD
@@ -3,7 +3,7 @@
pkgname=py3-testtools
_pkgname=testtools
pkgver=2.7.1
-pkgrel=1
+pkgrel=2
pkgdesc="Extensions to the Python standard library unit testing framework"
url="https://pypi.org/project/testtools"
arch="noarch"
@@ -11,7 +11,8 @@ license="MIT"
depends="python3 py3-hatch-vcs py3-fixtures"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
subpackages="$pkgname-pyc"
-source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
+source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz
+ pytest8.2.patch"
builddir="$srcdir"/$_pkgname-$pkgver
options="!check" # needs community/py3-twisted and testscenarios from pypi
@@ -28,4 +29,5 @@ package() {
sha512sums="
78af1c2af6f93671074dafedeaaf3ddbcc806e78c3153a3b90f88874c967e34a18cb85e5649b08fabb4ba4ae649eeb401e79c77c3b9233d9eee2a3c2267a4596 testtools-2.7.1.tar.gz
+64151feb16be07260758cc9020fa978a1810b8bbe7fc2f56fc5b6ef6f0ce3ae68c092a57280bca4671f3982bac6254db66cc730e3cae67ece1e85eb2f861f19a pytest8.2.patch
"
diff --git a/main/py3-testtools/pytest8.2.patch b/main/py3-testtools/pytest8.2.patch
new file mode 100644
index 00000000000..e3c9ee24d1b
--- /dev/null
+++ b/main/py3-testtools/pytest8.2.patch
@@ -0,0 +1,23 @@
+diff --git a/testtools/testcase.py b/testtools/testcase.py
+index 004fdb5..b8e9010 100644
+--- a/testtools/testcase.py
++++ b/testtools/testcase.py
+@@ -693,7 +693,17 @@ class TestCase(unittest.TestCase):
+
+ def _get_test_method(self):
+ method_name = getattr(self, '_testMethodName')
+- return getattr(self, method_name)
++ try:
++ m = getattr(self, method_name)
++ except AttributeError:
++ if method_name != "runTest":
++ # We allow instantiation with no explicit method name
++ # but not an *incorrect* or missing method name.
++ raise ValueError(
++ "no such test method in %s: %s" % (self.__class__, method_name)
++ )
++ else:
++ return m
+
+ def _run_test_method(self, result):
+ """Run the test method for this test.