Merge "Silence most of the deprecation spam"
This commit is contained in:
@@ -607,15 +607,28 @@ class Deprecations(fixtures.Fixture):
|
||||
# exception.
|
||||
warnings.filterwarnings('error', category=DeprecationWarning,
|
||||
module='^keystoneclient\\.')
|
||||
warnings.filterwarnings('ignore', category=DeprecationWarning,
|
||||
module='^debtcollector\\.')
|
||||
self.addCleanup(warnings.resetwarnings)
|
||||
|
||||
def expect_deprecations(self):
|
||||
"""Call this if the test expects to call deprecated function."""
|
||||
warnings.resetwarnings()
|
||||
warnings.filterwarnings('ignore', category=DeprecationWarning,
|
||||
module='^keystoneclient\\.')
|
||||
warnings.filterwarnings('ignore', category=DeprecationWarning,
|
||||
module='^debtcollector\\.')
|
||||
|
||||
@contextlib.contextmanager
|
||||
def expect_deprecations_here(self):
|
||||
warnings.resetwarnings()
|
||||
warnings.filterwarnings('ignore', category=DeprecationWarning,
|
||||
module='^keystoneclient\\.')
|
||||
warnings.filterwarnings('ignore', category=DeprecationWarning,
|
||||
module='^debtcollector\\.')
|
||||
yield
|
||||
warnings.resetwarnings()
|
||||
warnings.filterwarnings('error', category=DeprecationWarning,
|
||||
module='^keystoneclient\\.')
|
||||
warnings.filterwarnings('ignore', category=DeprecationWarning,
|
||||
module='^debtcollector\\.')
|
||||
|
@@ -15,6 +15,7 @@
|
||||
import calendar
|
||||
import datetime
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import stat
|
||||
@@ -209,6 +210,7 @@ class BaseAuthTokenMiddlewareTest(testtools.TestCase):
|
||||
super(BaseAuthTokenMiddlewareTest, self).setUp()
|
||||
|
||||
self.useFixture(client_fixtures.Deprecations())
|
||||
self.logger = self.useFixture(fixtures.FakeLogger(level=logging.DEBUG))
|
||||
|
||||
self.expected_env = expected_env or dict()
|
||||
self.fake_app = fake_app or FakeApp
|
||||
@@ -1678,6 +1680,7 @@ class TokenEncodingTest(testtools.TestCase):
|
||||
def setUp(self):
|
||||
super(TokenEncodingTest, self).setUp()
|
||||
self.useFixture(client_fixtures.Deprecations())
|
||||
self.logger = self.useFixture(fixtures.FakeLogger(level=logging.DEBUG))
|
||||
|
||||
def test_unquoted_token(self):
|
||||
self.assertEqual('foo%20bar', auth_token.safe_quote('foo bar'))
|
||||
|
@@ -48,6 +48,7 @@ class S3TokenMiddlewareTestBase(utils.TestCase):
|
||||
def setUp(self):
|
||||
super(S3TokenMiddlewareTestBase, self).setUp()
|
||||
|
||||
self.useFixture(client_fixtures.Deprecations())
|
||||
self.conf = {
|
||||
'auth_host': self.TEST_HOST,
|
||||
'auth_port': self.TEST_PORT,
|
||||
|
Reference in New Issue
Block a user