From 236e6cb5881168a79a194b43c2d8dff7a14c3f03 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Tue, 15 Feb 2022 10:31:32 +0100 Subject: [PATCH] Refs #31407 -- Handled potential exception in test cleanup. The test view may not be called when running the tests with --parallel=2 or greater. Catch the AttributeError for this case. --- tests/handlers/views.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/handlers/views.py b/tests/handlers/views.py index e8e248b798..b7d0716afc 100644 --- a/tests/handlers/views.py +++ b/tests/handlers/views.py @@ -63,7 +63,11 @@ class CoroutineClearingView: return self._unawaited_coroutine def __del__(self): - self._unawaited_coroutine.close() + try: + self._unawaited_coroutine.close() + except AttributeError: + # View was never called. + pass async_unawaited = CoroutineClearingView()