diff options
-rw-r--r-- | qutebrowser/browser/webengine/notification.py | 2 | ||||
-rw-r--r-- | qutebrowser/completion/models/miscmodels.py | 4 | ||||
-rw-r--r-- | qutebrowser/config/websettings.py | 1 | ||||
-rw-r--r-- | qutebrowser/misc/guiprocess.py | 2 | ||||
-rw-r--r-- | tests/helpers/logfail.py | 3 | ||||
-rw-r--r-- | tests/unit/components/test_hostblock.py | 2 | ||||
-rw-r--r-- | tests/unit/utils/test_log.py | 9 |
7 files changed, 10 insertions, 13 deletions
diff --git a/qutebrowser/browser/webengine/notification.py b/qutebrowser/browser/webengine/notification.py index f8e1a59b1..e943e44e9 100644 --- a/qutebrowser/browser/webengine/notification.py +++ b/qutebrowser/browser/webengine/notification.py @@ -722,7 +722,7 @@ class DBusNotificationAdapter(AbstractNotificationAdapter): } def __init__(self, parent: QObject = None) -> None: - super().__init__(bridge) + super().__init__(parent) assert _notifications_supported() if utils.is_windows: diff --git a/qutebrowser/completion/models/miscmodels.py b/qutebrowser/completion/models/miscmodels.py index 7642bf904..d8ebafb29 100644 --- a/qutebrowser/completion/models/miscmodels.py +++ b/qutebrowser/completion/models/miscmodels.py @@ -230,9 +230,7 @@ def _qdatetime_to_completion_format(qdate): if not qdate.isValid(): ts = 0 else: - ts = qdate.toMSecsSinceEpoch() - if ts < 0: - ts = 0 + ts = max(qdate.toMSecsSinceEpoch(), 0) pydate = datetime.datetime.fromtimestamp(ts / 1000) return pydate.strftime(config.val.completion.timestamp_format) diff --git a/qutebrowser/config/websettings.py b/qutebrowser/config/websettings.py index 7556d2b6d..41aeec6a3 100644 --- a/qutebrowser/config/websettings.py +++ b/qutebrowser/config/websettings.py @@ -238,6 +238,7 @@ def user_agent(url: QUrl = None) -> str: def init(args: argparse.Namespace) -> None: """Initialize all QWeb(Engine)Settings.""" + utils.unused(args) if objects.backend == usertypes.Backend.QtWebEngine: from qutebrowser.browser.webengine import webenginesettings webenginesettings.init() diff --git a/qutebrowser/misc/guiprocess.py b/qutebrowser/misc/guiprocess.py index c93fad09b..8e9747ad8 100644 --- a/qutebrowser/misc/guiprocess.py +++ b/qutebrowser/misc/guiprocess.py @@ -262,7 +262,7 @@ class GUIProcess(QObject): QProcess.Crashed: f"{what.capitalize()} crashed", QProcess.Timedout: f"{what.capitalize()} timed out", QProcess.WriteError: f"Write error for {what}", - QProcess.WriteError: f"Read error for {what}", + QProcess.ReadError: f"Read error for {what}", } error_string = self._proc.errorString() msg = ': '.join([error_descriptions[error], error_string]) diff --git a/tests/helpers/logfail.py b/tests/helpers/logfail.py index ae4ac9bc0..15d5a9253 100644 --- a/tests/helpers/logfail.py +++ b/tests/helpers/logfail.py @@ -39,8 +39,7 @@ class LogFailHandler(logging.Handler): if logger.name == 'messagemock': return - if (logger.level == record.levelno or - root_logger.level == record.levelno): + if record.levelno in (logger.level, root_logger.level): # caplog.at_level(...) was used with the level of this message, # i.e. it was expected. return diff --git a/tests/unit/components/test_hostblock.py b/tests/unit/components/test_hostblock.py index 6a71058ea..5949f92f8 100644 --- a/tests/unit/components/test_hostblock.py +++ b/tests/unit/components/test_hostblock.py @@ -427,7 +427,7 @@ def test_invalid_utf8(config_stub, tmp_path, caplog, host_blocker_factory, locat with caplog.at_level(logging.ERROR): current_download.successful = True current_download.finished.emit() - expected = r"Failed to decode: " r"b'https://www.example.org/\xa0localhost" + expected = r"Failed to decode: b'https://www.example.org/\xa0localhost" assert caplog.messages[-2].startswith(expected) else: current_download.successful = True diff --git a/tests/unit/utils/test_log.py b/tests/unit/utils/test_log.py index 7682c1156..7b0f5293e 100644 --- a/tests/unit/utils/test_log.py +++ b/tests/unit/utils/test_log.py @@ -53,8 +53,7 @@ def restore_loggers(): saved_level_to_name = logging._levelToName.copy() logger_states = {} for name in saved_loggers: - logger_states[name] = getattr(saved_loggers[name], 'disabled', - None) + logger_states[name] = getattr(saved_loggers[name], 'disabled', None) finally: logging._releaseLock() @@ -86,9 +85,9 @@ def restore_loggers(): logger_dict = logging.getLogger().manager.loggerDict logger_dict.clear() logger_dict.update(saved_loggers) - for name in logger_states: - if logger_states[name] is not None: - saved_loggers[name].disabled = logger_states[name] + for name, state in logger_states.items(): + if state is not None: + saved_loggers[name].disabled = state finally: logging._releaseLock() |