Skip to content

Commit 0ba2f4d

Browse files
authored
Merge pull request #564 from OumarCamara/fix/reset-force_failure
Clear force_failure in _reset()
2 parents aec1c9e + affbc5b commit 0ba2f4d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ NEXT
88

99
Improvements
1010
------------
11+
* Clear ``force_failure`` in ``_reset()`` so that re-running a test
12+
after an ``expectThat`` failure can succeed if successful conditions are met again.
13+
(OumarCamara, #563)
1114

1215
* Make ``extract_result()`` and ``DeferredNotFired`` public APIs in
1316
``testtools.twistedsupport``. These utilities are useful for extracting

testtools/testcase.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,9 @@ def _reset(self) -> None:
307307
# __details is lazy-initialized so that a constructed-but-not-run
308308
# TestCase is safe to use with clone_test_with_new_id.
309309
self.__details: DetailsDict | None = None
310+
# force_failure is set by expectThat() on mismatch; must be
311+
# cleared so re-runs of the same test can succeed.
312+
self.force_failure: bool | None = None
310313

311314
def __eq__(self, other: object) -> bool:
312315
eq = getattr(unittest.TestCase, "__eq__", None)

0 commit comments

Comments
 (0)