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
This commit is contained in:
parent
adc8f306aa
commit
1d9d645a5e
|
@ -17,34 +17,10 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
import threading
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import mock
|
|
||||||
import testtools
|
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():
|
def rand_uuid_hex():
|
||||||
"""Generate a random UUID hex string
|
"""Generate a random UUID hex string
|
||||||
|
|
|
@ -19,7 +19,7 @@ from armada import const
|
||||||
from armada.handlers import armada
|
from armada.handlers import armada
|
||||||
from armada.utils.helm import TESTRUN_STATUS_SUCCESS, TESTRUN_STATUS_FAILURE
|
from armada.utils.helm import TESTRUN_STATUS_SUCCESS, TESTRUN_STATUS_FAILURE
|
||||||
from armada.tests.unit import base
|
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.utils.release import release_prefixer, get_release_status
|
||||||
from armada.exceptions import ManifestException
|
from armada.exceptions import ManifestException
|
||||||
from armada.exceptions.override_exceptions import InvalidOverrideValueException
|
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 import tiller_exceptions
|
||||||
from armada.exceptions.armada_exceptions import ChartDeployException
|
from armada.exceptions.armada_exceptions import ChartDeployException
|
||||||
|
|
||||||
makeMockThreadSafe()
|
|
||||||
|
|
||||||
TEST_YAML = """
|
TEST_YAML = """
|
||||||
---
|
---
|
||||||
schema: armada/Manifest/v1
|
schema: armada/Manifest/v1
|
||||||
|
|
Loading…
Reference in New Issue