Install PyQt from PyPI for pylint
This means we can be sure to have QtWebEngine available and won't have QtWebKit.
This commit is contained in:
parent
608ac89f06
commit
12520bf4ba
@ -70,7 +70,7 @@ valid-metaclass-classmethod-first-arg=cls
|
|||||||
|
|
||||||
[TYPECHECK]
|
[TYPECHECK]
|
||||||
# WORKAROUND for https://github.com/PyCQA/astroid/pull/357
|
# WORKAROUND for https://github.com/PyCQA/astroid/pull/357
|
||||||
ignored-modules=pytest
|
ignored-modules=pytest,PyQt5,PyQt5.QtWebKit
|
||||||
# MsgType added as WORKAROUND for
|
# MsgType added as WORKAROUND for
|
||||||
# https://bitbucket.org/logilab/pylint/issues/690/
|
# https://bitbucket.org/logilab/pylint/issues/690/
|
||||||
# UnsetObject because pylint infers any objreg.get(...) as UnsetObject.
|
# UnsetObject because pylint infers any objreg.get(...) as UnsetObject.
|
||||||
|
@ -19,9 +19,7 @@
|
|||||||
|
|
||||||
"""Wrapper over a QWebEngineCertificateError."""
|
"""Wrapper over a QWebEngineCertificateError."""
|
||||||
|
|
||||||
# pylint: disable=no-name-in-module,import-error,useless-suppression
|
|
||||||
from PyQt5.QtWebEngineWidgets import QWebEngineCertificateError
|
from PyQt5.QtWebEngineWidgets import QWebEngineCertificateError
|
||||||
# pylint: enable=no-name-in-module,import-error,useless-suppression
|
|
||||||
|
|
||||||
from qutebrowser.utils import usertypes, utils, debug
|
from qutebrowser.utils import usertypes, utils, debug
|
||||||
|
|
||||||
|
@ -19,9 +19,7 @@
|
|||||||
|
|
||||||
"""A request interceptor taking care of adblocking and custom headers."""
|
"""A request interceptor taking care of adblocking and custom headers."""
|
||||||
|
|
||||||
# pylint: disable=no-name-in-module,import-error,useless-suppression
|
|
||||||
from PyQt5.QtWebEngineCore import QWebEngineUrlRequestInterceptor
|
from PyQt5.QtWebEngineCore import QWebEngineUrlRequestInterceptor
|
||||||
# pylint: enable=no-name-in-module,import-error,useless-suppression
|
|
||||||
|
|
||||||
from qutebrowser.config import config
|
from qutebrowser.config import config
|
||||||
from qutebrowser.browser import shared
|
from qutebrowser.browser import shared
|
||||||
|
@ -25,9 +25,7 @@ import urllib
|
|||||||
import functools
|
import functools
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtSlot, Qt
|
from PyQt5.QtCore import pyqtSlot, Qt
|
||||||
# pylint: disable=no-name-in-module,import-error,useless-suppression
|
|
||||||
from PyQt5.QtWebEngineWidgets import QWebEngineDownloadItem
|
from PyQt5.QtWebEngineWidgets import QWebEngineDownloadItem
|
||||||
# pylint: enable=no-name-in-module,import-error,useless-suppression
|
|
||||||
|
|
||||||
from qutebrowser.browser import downloads
|
from qutebrowser.browser import downloads
|
||||||
from qutebrowser.utils import debug, usertypes, message, log, qtutils
|
from qutebrowser.utils import debug, usertypes, message, log, qtutils
|
||||||
|
@ -25,9 +25,7 @@
|
|||||||
from PyQt5.QtCore import QRect, Qt, QPoint, QEventLoop
|
from PyQt5.QtCore import QRect, Qt, QPoint, QEventLoop
|
||||||
from PyQt5.QtGui import QMouseEvent
|
from PyQt5.QtGui import QMouseEvent
|
||||||
from PyQt5.QtWidgets import QApplication
|
from PyQt5.QtWidgets import QApplication
|
||||||
# pylint: disable=no-name-in-module,import-error,useless-suppression
|
|
||||||
from PyQt5.QtWebEngineWidgets import QWebEngineSettings
|
from PyQt5.QtWebEngineWidgets import QWebEngineSettings
|
||||||
# pylint: enable=no-name-in-module,import-error,useless-suppression
|
|
||||||
|
|
||||||
from qutebrowser.utils import log, javascript
|
from qutebrowser.utils import log, javascript
|
||||||
from qutebrowser.browser import webelem
|
from qutebrowser.browser import webelem
|
||||||
@ -192,14 +190,9 @@ class WebEngineElement(webelem.AbstractWebElement):
|
|||||||
|
|
||||||
def _click_editable(self, click_target):
|
def _click_editable(self, click_target):
|
||||||
# WORKAROUND for https://bugreports.qt.io/browse/QTBUG-58515
|
# WORKAROUND for https://bugreports.qt.io/browse/QTBUG-58515
|
||||||
# pylint doesn't know about Qt.MouseEventSynthesizedBySystem
|
|
||||||
# because it was added in Qt 5.6, but we can be sure we use that with
|
|
||||||
# QtWebEngine.
|
|
||||||
# pylint: disable=no-member,useless-suppression
|
|
||||||
ev = QMouseEvent(QMouseEvent.MouseButtonPress, QPoint(0, 0),
|
ev = QMouseEvent(QMouseEvent.MouseButtonPress, QPoint(0, 0),
|
||||||
QPoint(0, 0), QPoint(0, 0), Qt.NoButton, Qt.NoButton,
|
QPoint(0, 0), QPoint(0, 0), Qt.NoButton, Qt.NoButton,
|
||||||
Qt.NoModifier, Qt.MouseEventSynthesizedBySystem)
|
Qt.NoModifier, Qt.MouseEventSynthesizedBySystem)
|
||||||
# pylint: enable=no-member,useless-suppression
|
|
||||||
self._tab.send_event(ev)
|
self._tab.send_event(ev)
|
||||||
# This actually "clicks" the element by calling focus() on it in JS.
|
# This actually "clicks" the element by calling focus() on it in JS.
|
||||||
self._js_call('focus')
|
self._js_call('focus')
|
||||||
|
@ -22,9 +22,7 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from PyQt5.QtCore import QUrl
|
from PyQt5.QtCore import QUrl
|
||||||
# pylint: disable=no-name-in-module,import-error,useless-suppression
|
|
||||||
from PyQt5.QtWebEngineWidgets import QWebEngineView
|
from PyQt5.QtWebEngineWidgets import QWebEngineView
|
||||||
# pylint: enable=no-name-in-module,import-error,useless-suppression
|
|
||||||
|
|
||||||
from qutebrowser.browser import inspector
|
from qutebrowser.browser import inspector
|
||||||
|
|
||||||
|
@ -20,10 +20,8 @@
|
|||||||
"""QtWebEngine specific qute://* handlers and glue code."""
|
"""QtWebEngine specific qute://* handlers and glue code."""
|
||||||
|
|
||||||
from PyQt5.QtCore import QBuffer, QIODevice
|
from PyQt5.QtCore import QBuffer, QIODevice
|
||||||
# pylint: disable=no-name-in-module,import-error,useless-suppression
|
|
||||||
from PyQt5.QtWebEngineCore import (QWebEngineUrlSchemeHandler,
|
from PyQt5.QtWebEngineCore import (QWebEngineUrlSchemeHandler,
|
||||||
QWebEngineUrlRequestJob)
|
QWebEngineUrlRequestJob)
|
||||||
# pylint: enable=no-name-in-module,import-error,useless-suppression
|
|
||||||
|
|
||||||
from qutebrowser.browser import qutescheme
|
from qutebrowser.browser import qutescheme
|
||||||
from qutebrowser.utils import log, qtutils
|
from qutebrowser.utils import log, qtutils
|
||||||
|
@ -30,10 +30,8 @@ Module attributes:
|
|||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
# pylint: disable=no-name-in-module,import-error,useless-suppression
|
|
||||||
from PyQt5.QtWebEngineWidgets import (QWebEngineSettings, QWebEngineProfile,
|
from PyQt5.QtWebEngineWidgets import (QWebEngineSettings, QWebEngineProfile,
|
||||||
QWebEngineScript)
|
QWebEngineScript)
|
||||||
# pylint: enable=no-name-in-module,import-error,useless-suppression
|
|
||||||
|
|
||||||
from qutebrowser.browser import shared
|
from qutebrowser.browser import shared
|
||||||
from qutebrowser.config import config, websettings
|
from qutebrowser.config import config, websettings
|
||||||
|
@ -25,10 +25,8 @@ import sip
|
|||||||
from PyQt5.QtCore import pyqtSlot, Qt, QEvent, QPoint, QUrl, QTimer
|
from PyQt5.QtCore import pyqtSlot, Qt, QEvent, QPoint, QUrl, QTimer
|
||||||
from PyQt5.QtGui import QKeyEvent
|
from PyQt5.QtGui import QKeyEvent
|
||||||
from PyQt5.QtNetwork import QAuthenticator
|
from PyQt5.QtNetwork import QAuthenticator
|
||||||
# pylint: disable=no-name-in-module,import-error,useless-suppression
|
|
||||||
from PyQt5.QtWidgets import QApplication
|
from PyQt5.QtWidgets import QApplication
|
||||||
from PyQt5.QtWebEngineWidgets import QWebEnginePage, QWebEngineScript
|
from PyQt5.QtWebEngineWidgets import QWebEnginePage, QWebEngineScript
|
||||||
# pylint: enable=no-name-in-module,import-error,useless-suppression
|
|
||||||
|
|
||||||
from qutebrowser.browser import browsertab, mouse, shared
|
from qutebrowser.browser import browsertab, mouse, shared
|
||||||
from qutebrowser.browser.webengine import (webview, webengineelem, tabhistory,
|
from qutebrowser.browser.webengine import (webview, webengineelem, tabhistory,
|
||||||
|
@ -23,9 +23,7 @@ import functools
|
|||||||
|
|
||||||
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QUrl, PYQT_VERSION
|
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QUrl, PYQT_VERSION
|
||||||
from PyQt5.QtGui import QPalette
|
from PyQt5.QtGui import QPalette
|
||||||
# pylint: disable=no-name-in-module,import-error,useless-suppression
|
|
||||||
from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEnginePage
|
from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEnginePage
|
||||||
# pylint: enable=no-name-in-module,import-error,useless-suppression
|
|
||||||
|
|
||||||
from qutebrowser.browser import shared
|
from qutebrowser.browser import shared
|
||||||
from qutebrowser.browser.webengine import certificateerror, webenginesettings
|
from qutebrowser.browser.webengine import certificateerror, webenginesettings
|
||||||
|
@ -342,7 +342,6 @@ def qt_message_handler(msg_type, context, msg):
|
|||||||
QtCore.QtFatalMsg: logging.CRITICAL,
|
QtCore.QtFatalMsg: logging.CRITICAL,
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
# pylint: disable=no-member,useless-suppression
|
|
||||||
qt_to_logging[QtCore.QtInfoMsg] = logging.INFO
|
qt_to_logging[QtCore.QtInfoMsg] = logging.INFO
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# Qt < 5.5
|
# Qt < 5.5
|
||||||
|
@ -68,7 +68,7 @@ def main():
|
|||||||
no_docstring_rgx = ['^__.*__$', '^setup$']
|
no_docstring_rgx = ['^__.*__$', '^setup$']
|
||||||
args = (['--disable={}'.format(','.join(disabled)),
|
args = (['--disable={}'.format(','.join(disabled)),
|
||||||
'--no-docstring-rgx=({})'.format('|'.join(no_docstring_rgx)),
|
'--no-docstring-rgx=({})'.format('|'.join(no_docstring_rgx)),
|
||||||
'--ignored-modules=helpers,pytest'] +
|
'--ignored-modules=helpers,pytest,PyQt5'] +
|
||||||
sys.argv[2:] + files)
|
sys.argv[2:] + files)
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env['PYTHONPATH'] = os.pathsep.join(pythonpath)
|
env['PYTHONPATH'] = os.pathsep.join(pythonpath)
|
||||||
|
@ -168,10 +168,9 @@ def pytest_configure(config):
|
|||||||
webengine_env = os.environ.get('QUTE_BDD_WEBENGINE', '')
|
webengine_env = os.environ.get('QUTE_BDD_WEBENGINE', '')
|
||||||
config.webengine = bool(webengine_arg or webengine_env)
|
config.webengine = bool(webengine_arg or webengine_env)
|
||||||
# Fail early if QtWebEngine is not available
|
# Fail early if QtWebEngine is not available
|
||||||
# pylint: disable=no-name-in-module,unused-variable,useless-suppression
|
# pylint: disable=unused-variable
|
||||||
if config.webengine:
|
if config.webengine:
|
||||||
import PyQt5.QtWebEngineWidgets
|
import PyQt5.QtWebEngineWidgets
|
||||||
# pylint: enable=no-name-in-module,unused-variable,useless-suppression
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='session', autouse=True)
|
@pytest.fixture(scope='session', autouse=True)
|
||||||
|
@ -62,7 +62,7 @@ class Request(testprocess.Line):
|
|||||||
def _check_status(self):
|
def _check_status(self):
|
||||||
"""Check if the http status is what we expected."""
|
"""Check if the http status is what we expected."""
|
||||||
# WORKAROUND for https://github.com/PyCQA/pylint/issues/399 (?)
|
# WORKAROUND for https://github.com/PyCQA/pylint/issues/399 (?)
|
||||||
# pylint: disable=no-member, useless-suppression
|
# pylint: disable=no-member
|
||||||
path_to_statuses = {
|
path_to_statuses = {
|
||||||
'/favicon.ico': [http.client.NOT_FOUND],
|
'/favicon.ico': [http.client.NOT_FOUND],
|
||||||
'/does-not-exist': [http.client.NOT_FOUND],
|
'/does-not-exist': [http.client.NOT_FOUND],
|
||||||
|
@ -51,7 +51,6 @@ def test_element_js_webkit(webview, js_enabled, expected):
|
|||||||
def test_simple_js_webengine(callback_checker, webengineview, js_enabled,
|
def test_simple_js_webengine(callback_checker, webengineview, js_enabled,
|
||||||
expected):
|
expected):
|
||||||
"""With QtWebEngine, runJavaScript works even when JS is off."""
|
"""With QtWebEngine, runJavaScript works even when JS is off."""
|
||||||
# pylint: disable=no-name-in-module,useless-suppression
|
|
||||||
# If we get there (because of the webengineview fixture) we can be certain
|
# If we get there (because of the webengineview fixture) we can be certain
|
||||||
# QtWebEngine is available
|
# QtWebEngine is available
|
||||||
from PyQt5.QtWebEngineWidgets import QWebEngineSettings
|
from PyQt5.QtWebEngineWidgets import QWebEngineSettings
|
||||||
|
2
tox.ini
2
tox.ini
@ -186,8 +186,8 @@ passenv =
|
|||||||
deps =
|
deps =
|
||||||
{[testenv]deps}
|
{[testenv]deps}
|
||||||
-r{toxinidir}/misc/requirements/requirements-pylint.txt
|
-r{toxinidir}/misc/requirements/requirements-pylint.txt
|
||||||
|
-r{toxinidir}/misc/requirements/requirements-pyqt.txt
|
||||||
commands =
|
commands =
|
||||||
{envpython} scripts/link_pyqt.py --tox {envdir}
|
|
||||||
{envpython} -m pylint scripts qutebrowser --output-format=colorized --reports=no {posargs}
|
{envpython} -m pylint scripts qutebrowser --output-format=colorized --reports=no {posargs}
|
||||||
{envpython} scripts/dev/run_pylint_on_tests.py {toxinidir} --output-format=colorized --reports=no {posargs}
|
{envpython} scripts/dev/run_pylint_on_tests.py {toxinidir} --output-format=colorized --reports=no {posargs}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user