Skip to content

Commit de2a7ce

Browse files
committed
Vendor LoggingFixture
This was removed from fixtures recently [1]. While it has been re-added [2], the fixture is small enough that we can just vendor it here. A future change will make fixtures a hard requirement of our test suite, since that's trivially doable now that we no longer package our tests. [1] testing-cabal/fixtures#114 [2] testing-cabal/fixtures#122 Signed-off-by: Stephen Finucane <stephen@that.guru>
1 parent 121c3a1 commit de2a7ce

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

tests/test_fixturesupport.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,23 @@
2020
except ImportError:
2121
fixtures = None # type: ignore
2222

23-
try:
24-
from fixtures.tests.helpers import LoggingFixture
25-
except ImportError:
26-
LoggingFixture = None
23+
if fixtures:
24+
25+
class LoggingFixture(fixtures.Fixture):
26+
def __init__(self, suffix: str = "", calls: list[str] | None = None) -> None:
27+
super().__init__()
28+
if calls is None:
29+
calls = []
30+
self.calls = calls
31+
self.suffix = suffix
32+
33+
def setUp(self) -> None:
34+
super().setUp()
35+
self.calls.append("setUp" + self.suffix)
36+
self.addCleanup(self.calls.append, "cleanUp" + self.suffix)
37+
38+
def reset(self) -> None:
39+
self.calls.append("reset" + self.suffix)
2740

2841

2942
class TestFixtureSupport(TestCase):

0 commit comments

Comments
 (0)