From b6f7e487551c962da1cc33863a7e65d731618f68 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Fri, 17 Nov 2017 13:12:07 -0600 Subject: [PATCH] Explicitly set expected log level for tests Some of the tests related to log level adjustment make assumptions about the default log level. While that should not change often, it would be best if the tests explicitly set the default it expects. Change-Id: I789175e70994be52181fed6339af96b6b85c1236 --- cinder/tests/unit/test_fixtures.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cinder/tests/unit/test_fixtures.py b/cinder/tests/unit/test_fixtures.py index 8ff9995c28a..1cdb41b6ac1 100644 --- a/cinder/tests/unit/test_fixtures.py +++ b/cinder/tests/unit/test_fixtures.py @@ -14,6 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. +import logging as pylogging + import fixtures as fx from oslo_log import log as logging import testtools @@ -25,6 +27,7 @@ class TestLogging(testtools.TestCase): def test_default_logging(self): stdlog = self.useFixture(fixtures.StandardLogging()) root = logging.getLogger() + root.logger.setLevel(pylogging.INFO) # there should be a null handler as well at DEBUG self.assertEqual(2, len(root.handlers), root.handlers) log = logging.getLogger(__name__) @@ -51,6 +54,7 @@ class TestLogging(testtools.TestCase): stdlog = self.useFixture(fixtures.StandardLogging()) root = logging.getLogger() + root.logger.setLevel(pylogging.INFO) # there should no longer be a null handler self.assertEqual(1, len(root.handlers), root.handlers) log = logging.getLogger(__name__)