aports/testing/py3-testresources/vendor-loggingfixture.patch
mio 9f54cd60b5 testing/py3-testresources: upgrade to 2.0.2, fix tests
https://github.com/testing-cabal/testresources/blob/master/NEWS

Fix `ModuleNotFoundError: No module named 'fixtures.tests'` error when
running `tests/test_test_resource.py` tests.

Ref: https://gitlab.alpinelinux.org/alpine/aports/-/issues/18025
2026-04-02 03:35:18 +00:00

54 lines
1.6 KiB
Diff

Patch-Source: https://github.com/testing-cabal/testresources/commit/254286ece0b94217b7b49f424391eeec15e400aa
---
From 254286ece0b94217b7b49f424391eeec15e400aa Mon Sep 17 00:00:00 2001
From: Stephen Finucane <stephen@that.guru>
Date: Fri, 6 Mar 2026 10:22:35 +0000
Subject: [PATCH] tests: Vendor LoggingFixture from fixtures
This was previously provided by the fixtures.test module, but this
module has been removed. Given the tiny size of this fixture, it
is easier to just provide it ourselves.
Signed-off-by: Stephen Finucane <stephen@that.guru>
---
testresources/tests/test_test_resource.py | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/testresources/tests/test_test_resource.py b/testresources/tests/test_test_resource.py
index 2501707..34e7e33 100644
--- a/testresources/tests/test_test_resource.py
+++ b/testresources/tests/test_test_resource.py
@@ -15,7 +15,7 @@
# license.
#
-from fixtures.tests.helpers import LoggingFixture
+import fixtures
import testtools
import testresources
@@ -31,6 +31,23 @@ def test_suite():
return result
+class LoggingFixture(fixtures.Fixture):
+ def __init__(self, suffix="", calls=None):
+ super().__init__()
+ if calls is None:
+ calls = []
+ self.calls = calls
+ self.suffix = suffix
+
+ def setUp(self):
+ super().setUp()
+ self.calls.append("setUp" + self.suffix)
+ self.addCleanup(self.calls.append, "cleanUp" + self.suffix)
+
+ def reset(self):
+ self.calls.append("reset" + self.suffix)
+
+
class MockResourceInstance(object):
def __init__(self, name):
self._name = name