Browse Source

Stop using oslotest.BaseTestCase

oslotest.BaseTestCase is going to be deprecated / removed in favor of using
the provided fixtures. oslotest.BaseTestCase does unnatural things with mock
cleanup that can't be fixed in a backwards-compatible way and we don't want
this odd cleanup or deprecation affecting our tests. See [1].

oslotest.BaseTestCase set up some fixtures that keystone didn't use:

 - timeout.Timeout
 - output.CaptureOutput
 - oslotest.log.ConfigureLogging

[1] https://review.openstack.org/#/c/280757/

Change-Id: I5d926fba83f0390fe06e75614d85d87d2cb9f285
changes/79/281579/3
Brant Knudson 6 years ago
parent
commit
262d0b66c3
  1. 3
      .testr.conf
  2. 8
      keystone/tests/unit/core.py

3
.testr.conf

@ -1,8 +1,5 @@
[DEFAULT]
test_command=
OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_LOG_CAPTURE=${OS_LOG_CAPTURE:-1} \
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./keystone/tests/unit} $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE

8
keystone/tests/unit/core.py

@ -34,11 +34,11 @@ from oslo_config import fixture as config_fixture
from oslo_log import fixture as log_fixture
from oslo_log import log
from oslo_utils import timeutils
import oslotest.base as oslotest
from oslotest import mockpatch
from paste.deploy import loadwsgi
import six
from sqlalchemy import exc
import testtools
from testtools import testcase
# NOTE(ayoung)
@ -491,7 +491,7 @@ def create_user(api, domain_id, **kwargs):
return user
class BaseTestCase(oslotest.BaseTestCase):
class BaseTestCase(testtools.TestCase):
"""Light weight base test class.
This is a placeholder that will eventually go away once the
@ -502,6 +502,10 @@ class BaseTestCase(oslotest.BaseTestCase):
def setUp(self):
super(BaseTestCase, self).setUp()
self.useFixture(fixtures.NestedTempfile())
self.useFixture(fixtures.TempHomeDir())
self.useFixture(mockpatch.PatchObject(sys, 'exit',
side_effect=UnexpectedExit))
self.useFixture(log_fixture.get_logging_handle_error_fixture())

Loading…
Cancel
Save