tests: Disable logging properly.

This commit is contained in:
Florian Bruhin 2014-08-12 16:28:32 +02:00
parent 3fa2530d53
commit 5b3abfa5dd
3 changed files with 23 additions and 6 deletions

View File

@ -21,6 +21,7 @@
"""Tests for BaseKeyParser."""
import logging
import unittest
from unittest.mock import Mock, patch
@ -42,7 +43,12 @@ CONFIG = {'test': {'<Ctrl-a>': 'ctrla',
def setUpModule():
"""Mock out some imports in basekeyparser."""
basekeyparser.QObject = Mock()
basekeyparser.logger = Mock()
logging.disable(logging.WARNING)
def tearDownModule():
"""Restore mocked out stuff."""
logging.disable(logging.NOTSET)
class SplitCountTests(unittest.TestCase):

View File

@ -21,7 +21,7 @@
import os
import unittest
from unittest.mock import Mock
import logging
import qutebrowser.utils.http as httputils
from qutebrowser.test.stubs import FakeNetworkReply
@ -894,8 +894,13 @@ class OurTests(AttachmentTestCase):
def setUpModule():
"""Mock out logging in httputils."""
httputils.logger = Mock()
"""Disable logging."""
logging.disable(logging.WARNING)
def tearDownModule():
"""Restore logging."""
logging.disable(logging.NOTSET)
if __name__ == '__main__':

View File

@ -22,6 +22,7 @@
import os
import os.path
import unittest
import logging
from unittest.mock import Mock
from PyQt5.QtCore import QProcess
@ -31,12 +32,17 @@ from qutebrowser.test.stubs import ConfigStub, FakeQProcess
def setUpModule():
"""Mock some things imported in the editor module."""
"""Disable logging and mock out some imports."""
logging.disable(logging.INFO)
editorutils.message = Mock()
editorutils.logger = Mock()
editorutils.QProcess = FakeQProcess
def tearDownModule():
"""Restore logging."""
logging.disable(logging.NOTSET)
class ArgTests(unittest.TestCase):
"""Test argument handling.