Don't crash on --logfilter
This commit is contained in:
parent
f91ace9622
commit
e3a58e84c6
|
|
@ -295,8 +295,9 @@ def init_log(args):
|
|||
Args:
|
||||
args: The argparse namespace.
|
||||
"""
|
||||
from qutebrowser.utils import log
|
||||
from qutebrowser.utils import log, qtlog
|
||||
log.init_log(args)
|
||||
qtlog.init(args)
|
||||
log.init.debug("Log initialized.")
|
||||
log.init.debug(str(machinery.INFO))
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import argparse
|
|||
from typing import (TYPE_CHECKING, Any, Iterator, Mapping, MutableSequence,
|
||||
Optional, Set, Tuple, Union, TextIO, Literal, cast)
|
||||
|
||||
from qutebrowser.utils import qtlog
|
||||
# Optional imports
|
||||
try:
|
||||
import colorama
|
||||
|
|
@ -205,7 +204,6 @@ def init_log(args: argparse.Namespace) -> None:
|
|||
root.setLevel(logging.NOTSET)
|
||||
logging.captureWarnings(True)
|
||||
_init_py_warnings()
|
||||
qtlog.init(args)
|
||||
_log_inited = True
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import importlib
|
|||
import re
|
||||
import json
|
||||
import platform
|
||||
from contextlib import nullcontext as does_not_raise
|
||||
|
||||
import pytest
|
||||
from qutebrowser.qt.core import QProcess, QPoint
|
||||
|
|
@ -916,3 +917,15 @@ def test_sandboxing(
|
|||
|
||||
status = dict(line.split("\t") for line in lines)
|
||||
assert status == expected_status
|
||||
|
||||
|
||||
@pytest.mark.not_frozen
|
||||
def test_logfilter_arg_does_not_crash(request, quteproc_new):
|
||||
args = ['--temp-basedir', '--debug', '--logfilter', 'commands, init, ipc, webview']
|
||||
|
||||
with does_not_raise():
|
||||
quteproc_new.start(args=args + _base_args(request.config))
|
||||
|
||||
# Waiting for quit to make sure no other warning is emitted
|
||||
quteproc_new.send_cmd(':quit')
|
||||
quteproc_new.wait_for_quit()
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import logging
|
|||
import pytest
|
||||
|
||||
from qutebrowser import qutebrowser
|
||||
from qutebrowser.utils import log, qtlog
|
||||
from qutebrowser.utils import qtlog
|
||||
|
||||
from qutebrowser.qt import core as qtcore
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ class TestQtMessageHandler:
|
|||
def init_args(self):
|
||||
parser = qutebrowser.get_argparser()
|
||||
args = parser.parse_args([])
|
||||
log.init_log(args)
|
||||
qtlog.init(args)
|
||||
|
||||
def test_empty_message(self, caplog):
|
||||
"""Make sure there's no crash with an empty message."""
|
||||
|
|
|
|||
Loading…
Reference in New Issue