From 2ee484990d4980cc975f5f5d593ceff04d897d4f Mon Sep 17 00:00:00 2001 From: Steve Pulec Date: Fri, 6 Apr 2018 09:26:47 -0400 Subject: [PATCH] Catch RuntimeError on unpatching in case of multiple unpatching. --- moto/core/models.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/moto/core/models.py b/moto/core/models.py index c9895c0cb..cc7b5d8f9 100644 --- a/moto/core/models.py +++ b/moto/core/models.py @@ -206,8 +206,15 @@ class ResponsesMockAWS(BaseMockAWS): ) def disable_patching(self): - botocore_mock.stop() - responses.stop() + try: + botocore_mock.stop() + except RuntimeError: + pass + + try: + responses.stop() + except RuntimeError: + pass MockAWS = ResponsesMockAWS