From 1d9d645a5e82358eda1fc8955d3e3ba9cd858708 Mon Sep 17 00:00:00 2001 From: Sean Eagan Date: Thu, 6 Feb 2020 08:55:25 -0600 Subject: [PATCH] Remove makeMockThreadSafe() It doesn't appear to be compatible with newer versions of python and the mock library, and wasn't working correctly anyways. Change-Id: I117d01bed40849587b2d0337aad56fccdf77e192 --- armada/tests/test_utils.py | 24 ----------------------- armada/tests/unit/handlers/test_armada.py | 4 +--- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/armada/tests/test_utils.py b/armada/tests/test_utils.py index 36c38204..f6d545ce 100644 --- a/armada/tests/test_utils.py +++ b/armada/tests/test_utils.py @@ -17,34 +17,10 @@ # under the License. import random import string -import threading import uuid -import mock import testtools -_mock_thread_safe = False -_mock_call_lock = threading.RLock() - - -# TODO(seaneagan): Get this working. -def makeMockThreadSafe(): - ''' - This attempts to make a subset of the mock library thread safe using - locking, so that the mock call records are accurate. - ''' - global _mock_thread_safe - if not _mock_thread_safe: - unsafe_mock_call = mock.CallableMixin._mock_call - - def safe_mock_call(*args, **kwargs): - with _mock_call_lock: - return unsafe_mock_call(*args, **kwargs) - - mock.CallableMixin._mock_call = safe_mock_call - - _mock_thread_safe = True - def rand_uuid_hex(): """Generate a random UUID hex string diff --git a/armada/tests/unit/handlers/test_armada.py b/armada/tests/unit/handlers/test_armada.py index c1aa7813..b5f2cc66 100644 --- a/armada/tests/unit/handlers/test_armada.py +++ b/armada/tests/unit/handlers/test_armada.py @@ -19,7 +19,7 @@ from armada import const from armada.handlers import armada from armada.utils.helm import TESTRUN_STATUS_SUCCESS, TESTRUN_STATUS_FAILURE from armada.tests.unit import base -from armada.tests.test_utils import AttrDict, makeMockThreadSafe +from armada.tests.test_utils import AttrDict from armada.utils.release import release_prefixer, get_release_status from armada.exceptions import ManifestException from armada.exceptions.override_exceptions import InvalidOverrideValueException @@ -27,8 +27,6 @@ from armada.exceptions.validate_exceptions import InvalidManifestException from armada.exceptions import tiller_exceptions from armada.exceptions.armada_exceptions import ChartDeployException -makeMockThreadSafe() - TEST_YAML = """ --- schema: armada/Manifest/v1