testing/py3-testresources: backport patch for python 3.12 compatibility

This patch refactors failIf to assertFalse to fix failing tests.

This pkgrel bump is also a rebuild against python 3.12.
This commit is contained in:
Wenlong Zhang 2024-07-04 11:19:40 +00:00 committed by Celeste
parent affc7b3bce
commit bf46d9bb51
2 changed files with 41 additions and 3 deletions

View File

@ -0,0 +1,34 @@
Patch-Source: https://github.com/testing-cabal/testresources/pull/15
--
From ea4b907fe3805a78018df77f1e43ff0573eb8c56 Mon Sep 17 00:00:00 2001
From: Wenlong Zhang <zhangwenlong@loongson.cn>
Date: Thu, 4 Jul 2024 11:17:56 +0000
Subject: [PATCH] Refactor failIf to assertFalse for Python 3.12 Compatibility
---
testresources/tests/test_resourced_test_case.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/testresources/tests/test_resourced_test_case.py b/testresources/tests/test_resourced_test_case.py
index 7d2cfba..3c8a1b3 100644
--- a/testresources/tests/test_resourced_test_case.py
+++ b/testresources/tests/test_resourced_test_case.py
@@ -129,7 +129,7 @@ class TestResourcedTestCase(testtools.TestCase):
self.resourced_case.resources = [("foo", self.resource_manager)]
self.resourced_case.setUpResources()
self.resourced_case.tearDownResources()
- self.failIf(hasattr(self.resourced_case, "foo"))
+ self.assertFalse(hasattr(self.resourced_case, "foo"))
def testTearDownResourcesStopsUsingResource(self):
# tearDownResources records that there is one less use of each
@@ -158,5 +158,5 @@ class TestResourcedTestCase(testtools.TestCase):
self.assertEqual(self.resourced_case.foo, self.resource)
self.assertEqual(self.resource_manager._uses, 1)
self.resourced_case.tearDown()
- self.failIf(hasattr(self.resourced_case, "foo"))
+ self.assertFalse(hasattr(self.resourced_case, "foo"))
self.assertEqual(self.resource_manager._uses, 0)
--
2.45.2

View File

@ -3,7 +3,7 @@
pkgname=py3-testresources
_pyname=testresources
pkgver=2.0.1
pkgrel=5
pkgrel=6
pkgdesc="A pyunit extension for managing expensive test resources"
url="https://launchpad.net/testresources"
arch="noarch"
@ -12,7 +12,8 @@ depends="python3"
makedepends="py3-setuptools py3-pbr"
checkdepends="py3-testtools"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pyname%${_pyname#?}}/$_pyname/$_pyname-$pkgver.tar.gz"
source="https://files.pythonhosted.org/packages/source/${_pyname%${_pyname#?}}/$_pyname/$_pyname-$pkgver.tar.gz
0001-Refactor-failIf-to-assertFalse-for-Python-3.12-Compa.patch"
builddir="$srcdir/$_pyname-$pkgver"
build() {
@ -28,4 +29,7 @@ package() {
rm -rf "$pkgdir"/usr/lib/python3*/site-packages/testresources/tests/
}
sha512sums="0b23432b019400fe378e957d14a91083eef7fe1130a494b567a5274d69e4e8e09ab75861e5453c3f217507e144cf179c908f84dd1a807992d4bee0b8d32cb0f4 testresources-2.0.1.tar.gz"
sha512sums="
0b23432b019400fe378e957d14a91083eef7fe1130a494b567a5274d69e4e8e09ab75861e5453c3f217507e144cf179c908f84dd1a807992d4bee0b8d32cb0f4 testresources-2.0.1.tar.gz
61e0133cf96d5cb0a9800e0ccff34161b496516d0eea600d9dc97cbb65e0181f7e2e7f60fd70c129b4e4381f4431f8c6629e81c67e396c4955ffb3502f83996d 0001-Refactor-failIf-to-assertFalse-for-Python-3.12-Compa.patch
"