Merge "test cleanup: Make base TestCase subclass oslotest"
This commit is contained in:
commit
526e4ac72f
22
nova/test.py
22
nova/test.py
@ -46,10 +46,9 @@ from oslo_serialization import jsonutils
|
|||||||
from oslo_utils.fixture import uuidsentinel as uuids
|
from oslo_utils.fixture import uuidsentinel as uuids
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
from oslo_versionedobjects import fixture as ovo_fixture
|
from oslo_versionedobjects import fixture as ovo_fixture
|
||||||
|
from oslotest import base
|
||||||
from oslotest import mock_fixture
|
from oslotest import mock_fixture
|
||||||
from oslotest import moxstubout
|
from oslotest import moxstubout
|
||||||
from oslotest import output
|
|
||||||
from oslotest import timeout
|
|
||||||
import six
|
import six
|
||||||
from six.moves import builtins
|
from six.moves import builtins
|
||||||
import testtools
|
import testtools
|
||||||
@ -151,7 +150,7 @@ class NovaExceptionReraiseFormatError(object):
|
|||||||
NovaExceptionReraiseFormatError.patch()
|
NovaExceptionReraiseFormatError.patch()
|
||||||
|
|
||||||
|
|
||||||
class TestCase(testtools.TestCase):
|
class TestCase(base.BaseTestCase):
|
||||||
"""Test case base class for all unit tests.
|
"""Test case base class for all unit tests.
|
||||||
|
|
||||||
Due to the slowness of DB access, please consider deriving from
|
Due to the slowness of DB access, please consider deriving from
|
||||||
@ -175,28 +174,21 @@ class TestCase(testtools.TestCase):
|
|||||||
# base class when USES_DB is True.
|
# base class when USES_DB is True.
|
||||||
NUMBER_OF_CELLS = 1
|
NUMBER_OF_CELLS = 1
|
||||||
|
|
||||||
TIMEOUT_SCALING_FACTOR = 1
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""Run before each test method to initialize test environment."""
|
"""Run before each test method to initialize test environment."""
|
||||||
super(TestCase, self).setUp()
|
# Ensure BaseTestCase's ConfigureLogging fixture is disabled since
|
||||||
# The Timeout fixture picks up env.OS_TEST_TIMEOUT, defaulting to 0.
|
# we're using our own (StandardLogging).
|
||||||
self.useFixture(timeout.Timeout(
|
with fixtures.EnvironmentVariable('OS_LOG_CAPTURE', '0'):
|
||||||
scaling_factor=self.TIMEOUT_SCALING_FACTOR))
|
super(TestCase, self).setUp()
|
||||||
|
|
||||||
# How many of which service we've started. {$service-name: $count}
|
# How many of which service we've started. {$service-name: $count}
|
||||||
self._service_fixture_count = collections.defaultdict(int)
|
self._service_fixture_count = collections.defaultdict(int)
|
||||||
|
|
||||||
self.useFixture(nova_fixtures.OpenStackSDKFixture())
|
self.useFixture(nova_fixtures.OpenStackSDKFixture())
|
||||||
|
|
||||||
self.useFixture(fixtures.NestedTempfile())
|
|
||||||
self.useFixture(fixtures.TempHomeDir())
|
|
||||||
self.useFixture(log_fixture.get_logging_handle_error_fixture())
|
self.useFixture(log_fixture.get_logging_handle_error_fixture())
|
||||||
|
|
||||||
self.output = self.useFixture(output.CaptureOutput())
|
self.stdlog = self.useFixture(nova_fixtures.StandardLogging())
|
||||||
|
|
||||||
self.stdlog = nova_fixtures.StandardLogging()
|
|
||||||
self.useFixture(self.stdlog)
|
|
||||||
|
|
||||||
# NOTE(sdague): because of the way we were using the lock
|
# NOTE(sdague): because of the way we were using the lock
|
||||||
# wrapper we ended up with a lot of tests that started
|
# wrapper we ended up with a lot of tests that started
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import fixtures
|
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
@ -42,7 +41,6 @@ class ConfTest(test.NoDBTestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ConfTest, self).setUp()
|
super(ConfTest, self).setUp()
|
||||||
self.useFixture(fixtures.NestedTempfile())
|
|
||||||
self.conf = self.TestConfigOpts()
|
self.conf = self.TestConfigOpts()
|
||||||
self.tempdirs = []
|
self.tempdirs = []
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user