Merge "Silence most of the deprecation spam"

This commit is contained in:
Jenkins
2015-11-26 02:36:45 +00:00
committed by Gerrit Code Review
3 changed files with 17 additions and 0 deletions

View File

@@ -607,15 +607,28 @@ class Deprecations(fixtures.Fixture):
# exception. # exception.
warnings.filterwarnings('error', category=DeprecationWarning, warnings.filterwarnings('error', category=DeprecationWarning,
module='^keystoneclient\\.') module='^keystoneclient\\.')
warnings.filterwarnings('ignore', category=DeprecationWarning,
module='^debtcollector\\.')
self.addCleanup(warnings.resetwarnings) self.addCleanup(warnings.resetwarnings)
def expect_deprecations(self): def expect_deprecations(self):
"""Call this if the test expects to call deprecated function.""" """Call this if the test expects to call deprecated function."""
warnings.resetwarnings() warnings.resetwarnings()
warnings.filterwarnings('ignore', category=DeprecationWarning,
module='^keystoneclient\\.')
warnings.filterwarnings('ignore', category=DeprecationWarning,
module='^debtcollector\\.')
@contextlib.contextmanager @contextlib.contextmanager
def expect_deprecations_here(self): def expect_deprecations_here(self):
warnings.resetwarnings() warnings.resetwarnings()
warnings.filterwarnings('ignore', category=DeprecationWarning,
module='^keystoneclient\\.')
warnings.filterwarnings('ignore', category=DeprecationWarning,
module='^debtcollector\\.')
yield yield
warnings.resetwarnings()
warnings.filterwarnings('error', category=DeprecationWarning, warnings.filterwarnings('error', category=DeprecationWarning,
module='^keystoneclient\\.') module='^keystoneclient\\.')
warnings.filterwarnings('ignore', category=DeprecationWarning,
module='^debtcollector\\.')

View File

@@ -15,6 +15,7 @@
import calendar import calendar
import datetime import datetime
import json import json
import logging
import os import os
import shutil import shutil
import stat import stat
@@ -209,6 +210,7 @@ class BaseAuthTokenMiddlewareTest(testtools.TestCase):
super(BaseAuthTokenMiddlewareTest, self).setUp() super(BaseAuthTokenMiddlewareTest, self).setUp()
self.useFixture(client_fixtures.Deprecations()) self.useFixture(client_fixtures.Deprecations())
self.logger = self.useFixture(fixtures.FakeLogger(level=logging.DEBUG))
self.expected_env = expected_env or dict() self.expected_env = expected_env or dict()
self.fake_app = fake_app or FakeApp self.fake_app = fake_app or FakeApp
@@ -1678,6 +1680,7 @@ class TokenEncodingTest(testtools.TestCase):
def setUp(self): def setUp(self):
super(TokenEncodingTest, self).setUp() super(TokenEncodingTest, self).setUp()
self.useFixture(client_fixtures.Deprecations()) self.useFixture(client_fixtures.Deprecations())
self.logger = self.useFixture(fixtures.FakeLogger(level=logging.DEBUG))
def test_unquoted_token(self): def test_unquoted_token(self):
self.assertEqual('foo%20bar', auth_token.safe_quote('foo bar')) self.assertEqual('foo%20bar', auth_token.safe_quote('foo bar'))

View File

@@ -48,6 +48,7 @@ class S3TokenMiddlewareTestBase(utils.TestCase):
def setUp(self): def setUp(self):
super(S3TokenMiddlewareTestBase, self).setUp() super(S3TokenMiddlewareTestBase, self).setUp()
self.useFixture(client_fixtures.Deprecations())
self.conf = { self.conf = {
'auth_host': self.TEST_HOST, 'auth_host': self.TEST_HOST,
'auth_port': self.TEST_PORT, 'auth_port': self.TEST_PORT,