Register fatal_deprecations before use

The keystone.tests.unit.test_backend_sql.DeprecatedDecorators
tests would fail when run individually with an error

 oslo_config.cfg.NoSuchOptError: no such option: fatal_deprecations

This is because the way that fatal_deprecations gets registered is
when versionutils.report_deprecated_feature() is called.

The fix is to call versionutils.report_deprecated_feature() before
trying to set the fatal_deprecations option.

Change-Id: I6ad2dd0a47f00ea2ba05d587e0291230e789f057
Closes-Bug: 1474069
This commit is contained in:
Brant Knudson 2015-07-13 16:57:40 -05:00
parent 354be7753d
commit 44c241e18c
1 changed files with 9 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import mock
from oslo_config import cfg
from oslo_db import exception as db_exception
from oslo_db import options
from oslo_log import log
from oslo_log import versionutils
from six.moves import range
import sqlalchemy
@ -939,6 +940,14 @@ class SqlCredential(SqlTests):
class DeprecatedDecorators(SqlTests):
def setUp(self):
super(DeprecatedDecorators, self).setUp()
# The only reason this is here is because report_deprecated_feature()
# registers the fatal_deprecations option which these tests use.
versionutils.report_deprecated_feature(
log.getLogger(__name__), 'ignore this message')
def test_assignment_to_role_api(self):
"""Test that calling one of the methods does call LOG.deprecated.