diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 00c8f98d8..04eff1925 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -644,8 +644,8 @@ class Quitter: session_manager = objreg.get('session-manager') session_manager.save(session, with_private=True) - # Make sure we're not accepting a connection from the new process before - # we fully exited. + # Make sure we're not accepting a connection from the new process + # before we fully exited. ipc.server.shutdown() # Open a new process and immediately shutdown the existing one diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index 707ea10c3..4de4bf26f 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -19,7 +19,6 @@ """Wrapper over a QWebEngineView.""" -import os import math import functools import html as html_utils diff --git a/qutebrowser/config/configinit.py b/qutebrowser/config/configinit.py index 1b36fd675..a046395c3 100644 --- a/qutebrowser/config/configinit.py +++ b/qutebrowser/config/configinit.py @@ -26,8 +26,8 @@ from PyQt5.QtWidgets import QMessageBox from qutebrowser.config import (config, configdata, configfiles, configtypes, configexc) -from qutebrowser.utils import objreg, qtutils, usertypes, log, standarddir -from qutebrowser.misc import earlyinit, msgbox, objects +from qutebrowser.utils import objreg, usertypes, log, standarddir +from qutebrowser.misc import msgbox, objects # Error which happened during init, so we can show a message box. diff --git a/qutebrowser/misc/backendproblem.py b/qutebrowser/misc/backendproblem.py index bfe2f7cb0..6bc10ba79 100644 --- a/qutebrowser/misc/backendproblem.py +++ b/qutebrowser/misc/backendproblem.py @@ -148,7 +148,7 @@ def _handle_nouveau_graphics(): force_sw_var in os.environ): return - if config.force_software_rendering: + if config.val.force_software_rendering: os.environ[force_sw_var] = '1' return @@ -175,7 +175,8 @@ def _handle_nouveau_graphics(): def _handle_wayland(): assert objects.backend == usertypes.Backend.QtWebEngine, objects.backend - if QApplication.instance().platformName() not in ['wayland', 'wayland-egl']: + platform = QApplication.instance().platformName() + if platform not in ['wayland', 'wayland-egl']: return _show_dialog( @@ -204,6 +205,7 @@ class BackendImports: def _try_import_backends(): """Check whether backends can be imported and return BackendImports.""" + # pylint: disable=unused-variable results = BackendImports() try: diff --git a/qutebrowser/misc/crashsignal.py b/qutebrowser/misc/crashsignal.py index 9899cfcd3..b90eae829 100644 --- a/qutebrowser/misc/crashsignal.py +++ b/qutebrowser/misc/crashsignal.py @@ -36,7 +36,7 @@ except ImportError: import attr from PyQt5.QtCore import (pyqtSlot, qInstallMessageHandler, QObject, QSocketNotifier, QTimer, QUrl) -from PyQt5.QtWidgets import QApplication, QDialog +from PyQt5.QtWidgets import QApplication from qutebrowser.commands import cmdutils from qutebrowser.misc import earlyinit, crashdialog, ipc diff --git a/qutebrowser/misc/ipc.py b/qutebrowser/misc/ipc.py index c8c9d83b7..c9f982365 100644 --- a/qutebrowser/misc/ipc.py +++ b/qutebrowser/misc/ipc.py @@ -113,15 +113,15 @@ class ListenError(Error): message: The error message. """ - def __init__(self, server): + def __init__(self, local_server): """Constructor. Args: - server: The QLocalServer which has the error set. + local_server: The QLocalServer which has the error set. """ super().__init__() - self.code = server.serverError() - self.message = server.errorString() + self.code = local_server.serverError() + self.message = local_server.errorString() def __str__(self): return "Error while listening to IPC server: {} (error {})".format( diff --git a/qutebrowser/qutebrowser.py b/qutebrowser/qutebrowser.py index 8c80dfc22..1b1cfb013 100644 --- a/qutebrowser/qutebrowser.py +++ b/qutebrowser/qutebrowser.py @@ -27,8 +27,8 @@ qutebrowser's initialization process roughly looks like this: it's too old. - The main() function in this file gets invoked - Argument parsing takes place -- earlyinit.early_init() gets invoked to do various low-level initialization and - checks whether all dependencies are met. +- earlyinit.early_init() gets invoked to do various low-level initialization + and checks whether all dependencies are met. - app.run() gets called, which takes over. See the docstring of app.py for details. """ diff --git a/tests/unit/config/test_configinit.py b/tests/unit/config/test_configinit.py index 1332499de..02b87ebda 100644 --- a/tests/unit/config/test_configinit.py +++ b/tests/unit/config/test_configinit.py @@ -39,9 +39,6 @@ def init_patch(qapp, fake_save_manager, monkeypatch, config_tmpdir, monkeypatch.setattr(config, 'key_instance', None) monkeypatch.setattr(config, 'change_filters', []) monkeypatch.setattr(configinit, '_init_errors', None) - # Make sure we get no SSL warning - monkeypatch.setattr(configinit.earlyinit, 'check_backend_ssl_support', - lambda _backend: None) yield try: objreg.delete('config-commands') @@ -242,33 +239,23 @@ class TestQtArgs: assert configinit.qt_args(parsed) == [sys.argv[0], '--foo', '--bar'] -@pytest.mark.parametrize('arg, confval, can_import, is_new_webkit, used', [ +@pytest.mark.parametrize('arg, confval, used', [ # overridden by commandline arg - ('webkit', 'auto', False, False, usertypes.Backend.QtWebKit), - # overridden by config - (None, 'webkit', False, False, usertypes.Backend.QtWebKit), - # WebKit available but too old - (None, 'auto', True, False, usertypes.Backend.QtWebEngine), - # WebKit available and new - (None, 'auto', True, True, usertypes.Backend.QtWebKit), - # WebKit unavailable - (None, 'auto', False, False, usertypes.Backend.QtWebEngine), + ('webkit', 'webengine', usertypes.Backend.QtWebKit), + # set in config + (None, 'webkit', usertypes.Backend.QtWebKit), ]) def test_get_backend(monkeypatch, fake_args, config_stub, - arg, confval, can_import, is_new_webkit, used): + arg, confval, used): real_import = __import__ def fake_import(name, *args, **kwargs): if name != 'PyQt5.QtWebKit': return real_import(name, *args, **kwargs) - if can_import: - return None raise ImportError fake_args.backend = arg config_stub.val.backend = confval - monkeypatch.setattr(configinit.qtutils, 'is_new_qtwebkit', - lambda: is_new_webkit) monkeypatch.setattr('builtins.__import__', fake_import) assert configinit.get_backend(fake_args) == used