diff options
author | Zuul <zuul@review.opendev.org> | 2019-11-23 05:31:44 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2019-11-23 05:31:45 +0000 |
commit | 526e4ac72f24afc99ba03eae75f50605b5f3b20f (patch) | |
tree | f65b80412caaf74ccf6c840adeed35e0257498ae /nova/test.py | |
parent | e20d529dbf656ddcacb7ab3497a6c71e89985f50 (diff) | |
parent | ccf7eabdf8375daad33e9c6164c0e302a0ab8e15 (diff) | |
download | nova-526e4ac72f24afc99ba03eae75f50605b5f3b20f.tar.gz |
Merge "test cleanup: Make base TestCase subclass oslotest"
Diffstat (limited to 'nova/test.py')
-rw-r--r-- | nova/test.py | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/nova/test.py b/nova/test.py index ef0d06ff80..a452fee8f7 100644 --- a/nova/test.py +++ b/nova/test.py @@ -46,10 +46,9 @@ from oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils from oslo_versionedobjects import fixture as ovo_fixture +from oslotest import base from oslotest import mock_fixture from oslotest import moxstubout -from oslotest import output -from oslotest import timeout import six from six.moves import builtins import testtools @@ -151,7 +150,7 @@ class NovaExceptionReraiseFormatError(object): NovaExceptionReraiseFormatError.patch() -class TestCase(testtools.TestCase): +class TestCase(base.BaseTestCase): """Test case base class for all unit tests. 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. NUMBER_OF_CELLS = 1 - TIMEOUT_SCALING_FACTOR = 1 - def setUp(self): """Run before each test method to initialize test environment.""" - super(TestCase, self).setUp() - # The Timeout fixture picks up env.OS_TEST_TIMEOUT, defaulting to 0. - self.useFixture(timeout.Timeout( - scaling_factor=self.TIMEOUT_SCALING_FACTOR)) + # Ensure BaseTestCase's ConfigureLogging fixture is disabled since + # we're using our own (StandardLogging). + with fixtures.EnvironmentVariable('OS_LOG_CAPTURE', '0'): + super(TestCase, self).setUp() # How many of which service we've started. {$service-name: $count} self._service_fixture_count = collections.defaultdict(int) self.useFixture(nova_fixtures.OpenStackSDKFixture()) - self.useFixture(fixtures.NestedTempfile()) - self.useFixture(fixtures.TempHomeDir()) self.useFixture(log_fixture.get_logging_handle_error_fixture()) - self.output = self.useFixture(output.CaptureOutput()) - - self.stdlog = nova_fixtures.StandardLogging() - self.useFixture(self.stdlog) + self.stdlog = self.useFixture(nova_fixtures.StandardLogging()) # NOTE(sdague): because of the way we were using the lock # wrapper we ended up with a lot of tests that started |