diff --git a/landscape/lib/testing.py b/landscape/lib/testing.py index 1c13b962..b9c6e06c 100644 --- a/landscape/lib/testing.py +++ b/landscape/lib/testing.py @@ -685,7 +685,12 @@ def fake(): # because the call might cancel it! call._data = self.call_later(seconds, fake)._data try: - f(*args, **kwargs) + deferred = f(*args, **kwargs) + + if hasattr(deferred, "result") and isinstance(deferred.result, Failure): + # Required for some failures to get GC'd properly flushed. + # Twisted did this in versions < 24.10, but now we have to. + deferred.result.cleanFailure() except Exception: if call.active: self.cancel_call(call)