tests: Disable logging properly.
This commit is contained in:
parent
3fa2530d53
commit
5b3abfa5dd
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
"""Tests for BaseKeyParser."""
|
"""Tests for BaseKeyParser."""
|
||||||
|
|
||||||
|
import logging
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import Mock, patch
|
from unittest.mock import Mock, patch
|
||||||
|
|
||||||
@ -42,7 +43,12 @@ CONFIG = {'test': {'<Ctrl-a>': 'ctrla',
|
|||||||
def setUpModule():
|
def setUpModule():
|
||||||
"""Mock out some imports in basekeyparser."""
|
"""Mock out some imports in basekeyparser."""
|
||||||
basekeyparser.QObject = Mock()
|
basekeyparser.QObject = Mock()
|
||||||
basekeyparser.logger = Mock()
|
logging.disable(logging.WARNING)
|
||||||
|
|
||||||
|
|
||||||
|
def tearDownModule():
|
||||||
|
"""Restore mocked out stuff."""
|
||||||
|
logging.disable(logging.NOTSET)
|
||||||
|
|
||||||
|
|
||||||
class SplitCountTests(unittest.TestCase):
|
class SplitCountTests(unittest.TestCase):
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import Mock
|
import logging
|
||||||
|
|
||||||
import qutebrowser.utils.http as httputils
|
import qutebrowser.utils.http as httputils
|
||||||
from qutebrowser.test.stubs import FakeNetworkReply
|
from qutebrowser.test.stubs import FakeNetworkReply
|
||||||
@ -894,8 +894,13 @@ class OurTests(AttachmentTestCase):
|
|||||||
|
|
||||||
|
|
||||||
def setUpModule():
|
def setUpModule():
|
||||||
"""Mock out logging in httputils."""
|
"""Disable logging."""
|
||||||
httputils.logger = Mock()
|
logging.disable(logging.WARNING)
|
||||||
|
|
||||||
|
|
||||||
|
def tearDownModule():
|
||||||
|
"""Restore logging."""
|
||||||
|
logging.disable(logging.NOTSET)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import unittest
|
import unittest
|
||||||
|
import logging
|
||||||
from unittest.mock import Mock
|
from unittest.mock import Mock
|
||||||
|
|
||||||
from PyQt5.QtCore import QProcess
|
from PyQt5.QtCore import QProcess
|
||||||
@ -31,12 +32,17 @@ from qutebrowser.test.stubs import ConfigStub, FakeQProcess
|
|||||||
|
|
||||||
|
|
||||||
def setUpModule():
|
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.message = Mock()
|
||||||
editorutils.logger = Mock()
|
|
||||||
editorutils.QProcess = FakeQProcess
|
editorutils.QProcess = FakeQProcess
|
||||||
|
|
||||||
|
|
||||||
|
def tearDownModule():
|
||||||
|
"""Restore logging."""
|
||||||
|
logging.disable(logging.NOTSET)
|
||||||
|
|
||||||
|
|
||||||
class ArgTests(unittest.TestCase):
|
class ArgTests(unittest.TestCase):
|
||||||
|
|
||||||
"""Test argument handling.
|
"""Test argument handling.
|
||||||
|
Loading…
Reference in New Issue
Block a user