From 53f7068b2b346dffeed71c3ee66d80f25dfaee00 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 6 Mar 2026 10:35:49 +0000 Subject: [PATCH] Re-add helpers module These are part of our public API and should not be removed in a patch release. We do however deprecate them. Signed-off-by: Stephen Finucane --- fixtures/tests/helpers.py | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 fixtures/tests/helpers.py diff --git a/fixtures/tests/helpers.py b/fixtures/tests/helpers.py new file mode 100644 index 0000000..5634517 --- /dev/null +++ b/fixtures/tests/helpers.py @@ -0,0 +1,44 @@ +# fixtures: Fixtures with cleanups for testing and convenience. +# +# Copyright (c) 2010, Robert Collins +# +# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause +# license at the users choice. A copy of both licenses are available in the +# project source as Apache-2.0 and BSD. You may not use this file except in +# compliance with one of these two licences. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# license you chose for the specific language governing permissions and +# limitations under that license. + +import warnings + +import fixtures + + +warnings.warn( + "This module is deprecated for removal", + DeprecationWarning, + stacklevel=2, +) + + +class LoggingFixture(fixtures.Fixture): + def __init__( + self, suffix: str = "", calls: list[str] | None = None + ) -> None: + super().__init__() + if calls is None: + calls = [] + self.calls = calls + self.suffix = suffix + + def setUp(self) -> None: + super().setUp() + self.calls.append("setUp" + self.suffix) + self.addCleanup(self.calls.append, "cleanUp" + self.suffix) + + def reset(self) -> None: + self.calls.append("reset" + self.suffix)