Remove moxstubout usage

As of oslotest version 3.5.0 moxstub will be deprecated,
so remove it where it has been used.

Change-Id: I9f038428cbea07a307f08c2251eafed7ab8bbea1
Signed-off-by: Chuck Short <chucks@redhat.com>
This commit is contained in:
Chuck Short 2018-08-22 07:20:31 -04:00
parent e49586e458
commit 19352892cf

View File

@ -13,8 +13,8 @@
# under the License. # under the License.
import logging import logging
import time
import fixtures
import mock import mock
from oslotest import base as test_base from oslotest import base as test_base
from oslotest import moxstubout from oslotest import moxstubout
@ -170,7 +170,6 @@ class ForeverRetryUncaughtExceptionsTest(test_base.BaseTestCase):
super(ForeverRetryUncaughtExceptionsTest, self).setUp() super(ForeverRetryUncaughtExceptionsTest, self).setUp()
moxfixture = self.useFixture(moxstubout.MoxStubout()) moxfixture = self.useFixture(moxstubout.MoxStubout())
self.mox = moxfixture.mox self.mox = moxfixture.mox
self.stubs = moxfixture.stubs
@excutils.forever_retry_uncaught_exceptions @excutils.forever_retry_uncaught_exceptions
def exception_generator(self): def exception_generator(self):
@ -186,7 +185,10 @@ class ForeverRetryUncaughtExceptionsTest(test_base.BaseTestCase):
pass pass
def exc_retrier_common_start(self): 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(logging, 'exception')
self.mox.StubOutWithMock(timeutils, 'now', self.mox.StubOutWithMock(timeutils, 'now',
use_mock_anything=True) use_mock_anything=True)
@ -211,7 +213,6 @@ class ForeverRetryUncaughtExceptionsTest(test_base.BaseTestCase):
self.exception_to_raise().AndReturn(None) self.exception_to_raise().AndReturn(None)
self.mox.ReplayAll() self.mox.ReplayAll()
self.exception_generator() self.exception_generator()
self.addCleanup(self.stubs.UnsetAll)
def test_exc_retrier_1exc_gives_1log(self): def test_exc_retrier_1exc_gives_1log(self):
self.exc_retrier_common_start() self.exc_retrier_common_start()