summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oslo_utils/strutils.py5
-rw-r--r--oslo_utils/tests/test_excutils.py9
2 files changed, 6 insertions, 8 deletions
diff --git a/oslo_utils/strutils.py b/oslo_utils/strutils.py
index 922ad22..ebcc104 100644
--- a/oslo_utils/strutils.py
+++ b/oslo_utils/strutils.py
@@ -17,7 +17,6 @@
System-level utilities and helper functions.
"""
-import copy
import math
import re
import unicodedata
@@ -394,9 +393,7 @@ def mask_dict_password(dictionary, secret="***"): # nosec
if not isinstance(dictionary, dict):
raise TypeError("Expected a dictionary, got %s instead."
% type(dictionary))
-
- out = copy.deepcopy(dictionary)
-
+ out = {}
for k, v in dictionary.items():
if isinstance(v, dict):
out[k] = mask_dict_password(v, secret=secret)
diff --git a/oslo_utils/tests/test_excutils.py b/oslo_utils/tests/test_excutils.py
index 8e2650e..d4555f0 100644
--- a/oslo_utils/tests/test_excutils.py
+++ b/oslo_utils/tests/test_excutils.py
@@ -13,8 +13,8 @@
# under the License.
import logging
-import time
+import fixtures
import mock
from oslotest import base as test_base
from oslotest import moxstubout
@@ -170,7 +170,6 @@ class ForeverRetryUncaughtExceptionsTest(test_base.BaseTestCase):
super(ForeverRetryUncaughtExceptionsTest, self).setUp()
moxfixture = self.useFixture(moxstubout.MoxStubout())
self.mox = moxfixture.mox
- self.stubs = moxfixture.stubs
@excutils.forever_retry_uncaught_exceptions
def exception_generator(self):
@@ -186,7 +185,10 @@ class ForeverRetryUncaughtExceptionsTest(test_base.BaseTestCase):
pass
def exc_retrier_common_start(self):
- self.stubs.Set(time, 'sleep', self.my_time_sleep)
+ patch_time = fixtures.MockPatch(
+ 'time.sleep', self.my_time_sleep)
+ self.useFixture(patch_time)
+
self.mox.StubOutWithMock(logging, 'exception')
self.mox.StubOutWithMock(timeutils, 'now',
use_mock_anything=True)
@@ -211,7 +213,6 @@ class ForeverRetryUncaughtExceptionsTest(test_base.BaseTestCase):
self.exception_to_raise().AndReturn(None)
self.mox.ReplayAll()
self.exception_generator()
- self.addCleanup(self.stubs.UnsetAll)
def test_exc_retrier_1exc_gives_1log(self):
self.exc_retrier_common_start()