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
This commit is contained in:
Sean McGinnis 2017-11-17 13:12:07 -06:00
parent 4cbc03a0bd
commit b6f7e48755
1 changed files with 4 additions and 0 deletions

View File

@ -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__)