From 21d9c9a585b725ede18d25693e8823f369f7263f Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 17 May 2022 13:28:53 +0200 Subject: [PATCH] lint: Fix various small flake8 issues --- qutebrowser/browser/webengine/webview.py | 2 +- tests/conftest.py | 4 ++-- tests/unit/config/test_qtargs.py | 2 +- tests/unit/misc/test_ipc.py | 2 +- tests/unit/utils/test_qtutils.py | 14 +++++++------- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/qutebrowser/browser/webengine/webview.py b/qutebrowser/browser/webengine/webview.py index 452c63a38..739732efc 100644 --- a/qutebrowser/browser/webengine/webview.py +++ b/qutebrowser/browser/webengine/webview.py @@ -196,7 +196,7 @@ class WebEnginePage(QWebEnginePage): if machinery.IS_QT5: # Overridden method instead of signal - certificateError = _handle_certificate_error + certificateError = _handle_certificate_error # noqa: N815 def javaScriptConfirm(self, url, js_msg): """Override javaScriptConfirm to use qutebrowser prompts.""" diff --git a/tests/conftest.py b/tests/conftest.py index 074a4a11f..48e5660ee 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -120,8 +120,8 @@ def _apply_platform_markers(config, item): pytest.mark.skipif, not machinery.IS_QT6, f"Only runs on Qt 6, not {machinery.WRAPPER}"), - ('qt5_xfail', pytest.mark.xfail, machinery.IS_QT5, f"Fails on Qt 5"), - ('qt6_xfail', pytest.mark.skipif, machinery.IS_QT6, f"Fails on Qt 6"), + ('qt5_xfail', pytest.mark.xfail, machinery.IS_QT5, "Fails on Qt 5"), + ('qt6_xfail', pytest.mark.skipif, machinery.IS_QT6, "Fails on Qt 6"), ] for searched_marker, new_marker_kind, condition, default_reason in markers: diff --git a/tests/unit/config/test_qtargs.py b/tests/unit/config/test_qtargs.py index 5679a409c..da422062d 100644 --- a/tests/unit/config/test_qtargs.py +++ b/tests/unit/config/test_qtargs.py @@ -288,7 +288,7 @@ class TestWebEngineArgs: # 'never' is handled via interceptor ('5.15.2', 'never', None), - ('5.15.3', 'always', None), + ('5.15.3', 'never', None), # 'same-domain' ('5.15.2', 'same-domain', '--enable-features=ReducedReferrerGranularity'), diff --git a/tests/unit/misc/test_ipc.py b/tests/unit/misc/test_ipc.py index 838be3c30..9b6aa286c 100644 --- a/tests/unit/misc/test_ipc.py +++ b/tests/unit/misc/test_ipc.py @@ -102,7 +102,7 @@ class FakeSocket(QObject): readyRead = pyqtSignal() # noqa: N815 disconnected = pyqtSignal() - errorOccurred = pyqtSignal(QLocalSocket.LocalSocketError) + errorOccurred = pyqtSignal(QLocalSocket.LocalSocketError) # noqa: N815 def __init__(self, *, error=QLocalSocket.LocalSocketError.UnknownSocketError, state=None, data=None, connect_successful=True, parent=None): diff --git a/tests/unit/utils/test_qtutils.py b/tests/unit/utils/test_qtutils.py index 143603bad..6ae495826 100644 --- a/tests/unit/utils/test_qtutils.py +++ b/tests/unit/utils/test_qtutils.py @@ -206,12 +206,12 @@ def test_ensure_valid(obj, raising, exc_reason, exc_str): @pytest.mark.parametrize('status, raising, message', [ (QDataStream.Status.Ok, False, None), - (QDataStream.Status.ReadPastEnd, True, "The data stream has read past the end of " - "the data in the underlying device."), - (QDataStream.Status.ReadCorruptData, True, "The data stream has read corrupt " - "data."), - (QDataStream.Status.WriteFailed, True, "The data stream cannot write to the " - "underlying device."), + (QDataStream.Status.ReadPastEnd, True, + "The data stream has read past the end of the data in the underlying device."), + (QDataStream.Status.ReadCorruptData, True, + "The data stream has read corrupt data."), + (QDataStream.Status.WriteFailed, True, + "The data stream cannot write to the underlying device."), ]) def test_check_qdatastream(status, raising, message): """Test check_qdatastream. @@ -1058,7 +1058,7 @@ class TestLibraryPath: except AttributeError: enumtype = QLibraryInfo.LibraryLocation - our_names = set(member.value for member in qtutils.LibraryPath) + our_names = {member.value for member in qtutils.LibraryPath} qt_names = set(testutils.enum_members(QLibraryInfo, enumtype)) qt_names.discard("ImportsPath") # Moved to QmlImportsPath in Qt 6 assert qt_names == our_names