diff options
author | Petr Vaněk <arkamar@atlas.cz> | 2023-05-30 21:46:26 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2023-05-31 12:49:57 +0200 |
commit | 3a9c94a884fa08182efa8cb2de4a9357e7c73c53 (patch) | |
tree | 5b0561a2a12c108cde054478d9ea53e84153c3ce /dev-python/testresources/files | |
parent | dev-python/testscenarios: enable py3.12 (diff) | |
download | gentoo-3a9c94a884fa08182efa8cb2de4a9357e7c73c53.tar.gz gentoo-3a9c94a884fa08182efa8cb2de4a9357e7c73c53.tar.bz2 gentoo-3a9c94a884fa08182efa8cb2de4a9357e7c73c53.zip |
dev-python/testresources: enable py3.12
It was necessary to patch two tests due to removed failIf method in
py3.12.
Upstream-PR: https://github.com/testing-cabal/testresources/pull/15
Signed-off-by: Petr Vaněk <arkamar@atlas.cz>
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/testresources/files')
-rw-r--r-- | dev-python/testresources/files/testresources-2.0.1-py312-tests.patch | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/dev-python/testresources/files/testresources-2.0.1-py312-tests.patch b/dev-python/testresources/files/testresources-2.0.1-py312-tests.patch new file mode 100644 index 000000000000..7d4451ca43b9 --- /dev/null +++ b/dev-python/testresources/files/testresources-2.0.1-py312-tests.patch @@ -0,0 +1,35 @@ +Subject: [PATCH] Refactor failIf to assertFalse for Python 3.12 Compatibility + +This commit replaces deprecated failIf calls with assertFalse in the +test_resourced_test_case.py file. The failIf method was removed in +Python 3.12 [1-3]. + +[1] https://docs.python.org/3.12/whatsnew/3.12.html#removed +[2] https://github.com/python/cpython/issues/89325 +[3] https://github.com/python/cpython/pull/28268 + +Upstream-PR: https://github.com/testing-cabal/testresources/pull/15 + +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.39.2 + |