diff --git a/.flake8 b/.flake8 index 0955ed033..af9e54429 100644 --- a/.flake8 +++ b/.flake8 @@ -51,7 +51,7 @@ putty-ignore = /# pylint: disable=wildcard-import/ : +F403 /# pragma: no mccabe/ : +C901 tests/*/test_*.py : +D100,D101,D401 - tests/unit/browser/http/test_content_disposition.py : +D400 + tests/unit/browser/webkit/http/test_content_disposition.py : +D400 scripts/dev/ci/appveyor_install.py : +FI53 copyright-check = True copyright-regexp = # Copyright [\d-]+ .* diff --git a/.pylintrc b/.pylintrc index b8cc10090..2a4ded79f 100644 --- a/.pylintrc +++ b/.pylintrc @@ -66,5 +66,5 @@ valid-metaclass-classmethod-first-arg=cls # https://bitbucket.org/logilab/pylint/issues/690/ # UnsetObject because pylint infers any objreg.get(...) as UnsetObject. ignored-classes=qutebrowser.utils.objreg.UnsetObject, - qutebrowser.browser.webelem.WebElementWrapper, + qutebrowser.browser.webkit.webelem.WebElementWrapper, scripts.dev.check_coverage.MsgType diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 20d71d1ca..e0c8fe8f9 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -46,8 +46,10 @@ import qutebrowser.resources from qutebrowser.completion.models import instances as completionmodels from qutebrowser.commands import cmdutils, runners, cmdexc from qutebrowser.config import style, config, websettings, configexc -from qutebrowser.browser import urlmarks, cookies, cache, adblock, history -from qutebrowser.browser.network import qutescheme, proxy, networkmanager +from qutebrowser.browser import urlmarks, adblock +from qutebrowser.browser.webkit import cookies, cache, history +from qutebrowser.browser.webkit.network import (qutescheme, proxy, + networkmanager) from qutebrowser.mainwindow import mainwindow from qutebrowser.misc import readline, ipc, savemanager, sessions, crashsignal from qutebrowser.misc import utilcmds # pylint: disable=unused-import diff --git a/qutebrowser/browser/__init__.py b/qutebrowser/browser/__init__.py index d82a87b97..dbc790589 100644 --- a/qutebrowser/browser/__init__.py +++ b/qutebrowser/browser/__init__.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2016 Florian Bruhin (The Compiler) +# Copyright 2016 Florian Bruhin (The Compiler) # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 52f444058..eb2f31575 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -39,7 +39,8 @@ import pygments.formatters from qutebrowser.commands import userscripts, cmdexc, cmdutils, runners from qutebrowser.config import config, configexc -from qutebrowser.browser import webelem, inspector, urlmarks, downloads, mhtml +from qutebrowser.browser import urlmarks +from qutebrowser.browser.webkit import webelem, inspector, downloads, mhtml from qutebrowser.keyinput import modeman from qutebrowser.utils import (message, usertypes, log, qtutils, urlutils, objreg, utils, typing) diff --git a/qutebrowser/browser/downloadview.py b/qutebrowser/browser/downloadview.py index 860f4f1e6..c07eda434 100644 --- a/qutebrowser/browser/downloadview.py +++ b/qutebrowser/browser/downloadview.py @@ -25,7 +25,7 @@ import sip from PyQt5.QtCore import pyqtSlot, QSize, Qt, QTimer from PyQt5.QtWidgets import QListView, QSizePolicy, QMenu -from qutebrowser.browser import downloads +from qutebrowser.browser.webkit import downloads from qutebrowser.config import style from qutebrowser.utils import qtutils, utils, objreg diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index 6bdbfcf82..e2fcf1c1b 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -33,7 +33,7 @@ from PyQt5.QtWebKitWidgets import QWebPage from qutebrowser.config import config from qutebrowser.keyinput import modeman, modeparsers -from qutebrowser.browser import webelem +from qutebrowser.browser.webkit import webelem from qutebrowser.commands import userscripts, cmdexc, cmdutils, runners from qutebrowser.utils import usertypes, log, qtutils, message, objreg, utils diff --git a/qutebrowser/browser/pdfjs.py b/qutebrowser/browser/pdfjs.py index 8110d337b..cf7694252 100644 --- a/qutebrowser/browser/pdfjs.py +++ b/qutebrowser/browser/pdfjs.py @@ -23,7 +23,7 @@ import os from PyQt5.QtCore import QUrl -from qutebrowser.browser import webelem +from qutebrowser.browser.webkit import webelem from qutebrowser.utils import utils diff --git a/qutebrowser/browser/webkit/__init__.py b/qutebrowser/browser/webkit/__init__.py new file mode 100644 index 000000000..b67442be7 --- /dev/null +++ b/qutebrowser/browser/webkit/__init__.py @@ -0,0 +1,20 @@ +# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: + +# Copyright 2014-2016 Florian Bruhin (The Compiler) +# +# This file is part of qutebrowser. +# +# qutebrowser is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# qutebrowser is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with qutebrowser. If not, see . + +"""Classes related to the browser widgets for QtWebKit.""" diff --git a/qutebrowser/browser/cache.py b/qutebrowser/browser/webkit/cache.py similarity index 100% rename from qutebrowser/browser/cache.py rename to qutebrowser/browser/webkit/cache.py diff --git a/qutebrowser/browser/cookies.py b/qutebrowser/browser/webkit/cookies.py similarity index 100% rename from qutebrowser/browser/cookies.py rename to qutebrowser/browser/webkit/cookies.py diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/webkit/downloads.py similarity index 99% rename from qutebrowser/browser/downloads.py rename to qutebrowser/browser/webkit/downloads.py index 2ea88bc28..6cfee6acf 100644 --- a/qutebrowser/browser/downloads.py +++ b/qutebrowser/browser/webkit/downloads.py @@ -39,8 +39,8 @@ from qutebrowser.config import config from qutebrowser.commands import cmdexc, cmdutils from qutebrowser.utils import (message, usertypes, log, utils, urlutils, objreg, standarddir, qtutils) -from qutebrowser.browser import http -from qutebrowser.browser.network import networkmanager +from qutebrowser.browser.webkit import http +from qutebrowser.browser.webkit.network import networkmanager ModelRole = usertypes.enum('ModelRole', ['item'], start=Qt.UserRole, diff --git a/qutebrowser/browser/history.py b/qutebrowser/browser/webkit/history.py similarity index 100% rename from qutebrowser/browser/history.py rename to qutebrowser/browser/webkit/history.py diff --git a/qutebrowser/browser/http.py b/qutebrowser/browser/webkit/http.py similarity index 98% rename from qutebrowser/browser/http.py rename to qutebrowser/browser/webkit/http.py index cbe08c216..a0cff055e 100644 --- a/qutebrowser/browser/http.py +++ b/qutebrowser/browser/webkit/http.py @@ -23,7 +23,7 @@ import os.path from qutebrowser.utils import log -from qutebrowser.browser import rfc6266 +from qutebrowser.browser.webkit import rfc6266 from PyQt5.QtNetwork import QNetworkRequest diff --git a/qutebrowser/browser/inspector.py b/qutebrowser/browser/webkit/inspector.py similarity index 100% rename from qutebrowser/browser/inspector.py rename to qutebrowser/browser/webkit/inspector.py diff --git a/qutebrowser/browser/mhtml.py b/qutebrowser/browser/webkit/mhtml.py similarity index 99% rename from qutebrowser/browser/mhtml.py rename to qutebrowser/browser/webkit/mhtml.py index 55ef1bd05..32b8c7950 100644 --- a/qutebrowser/browser/mhtml.py +++ b/qutebrowser/browser/webkit/mhtml.py @@ -34,7 +34,7 @@ import email.message from PyQt5.QtCore import QUrl -from qutebrowser.browser import webelem, downloads +from qutebrowser.browser.webkit import webelem, downloads from qutebrowser.utils import log, objreg, message, usertypes, utils, urlutils try: diff --git a/qutebrowser/browser/network/__init__.py b/qutebrowser/browser/webkit/network/__init__.py similarity index 100% rename from qutebrowser/browser/network/__init__.py rename to qutebrowser/browser/webkit/network/__init__.py diff --git a/qutebrowser/browser/network/filescheme.py b/qutebrowser/browser/webkit/network/filescheme.py similarity index 98% rename from qutebrowser/browser/network/filescheme.py rename to qutebrowser/browser/webkit/network/filescheme.py index d4c20fd4d..cd0a6d489 100644 --- a/qutebrowser/browser/network/filescheme.py +++ b/qutebrowser/browser/webkit/network/filescheme.py @@ -25,7 +25,7 @@ import os -from qutebrowser.browser.network import schemehandler, networkreply +from qutebrowser.browser.webkit.network import schemehandler, networkreply from qutebrowser.utils import jinja diff --git a/qutebrowser/browser/network/networkmanager.py b/qutebrowser/browser/webkit/network/networkmanager.py similarity index 99% rename from qutebrowser/browser/network/networkmanager.py rename to qutebrowser/browser/webkit/network/networkmanager.py index 234622ad0..bdd98efc1 100644 --- a/qutebrowser/browser/network/networkmanager.py +++ b/qutebrowser/browser/webkit/network/networkmanager.py @@ -31,8 +31,8 @@ from PyQt5.QtNetwork import (QNetworkAccessManager, QNetworkReply, QSslError, from qutebrowser.config import config from qutebrowser.utils import (message, log, usertypes, utils, objreg, qtutils, urlutils, debug) -from qutebrowser.browser.network import qutescheme, networkreply -from qutebrowser.browser.network import filescheme +from qutebrowser.browser.webkit.network import qutescheme, networkreply +from qutebrowser.browser.webkit.network import filescheme HOSTBLOCK_ERROR_STRING = '%HOSTBLOCK%' diff --git a/qutebrowser/browser/network/networkreply.py b/qutebrowser/browser/webkit/network/networkreply.py similarity index 100% rename from qutebrowser/browser/network/networkreply.py rename to qutebrowser/browser/webkit/network/networkreply.py diff --git a/qutebrowser/browser/network/proxy.py b/qutebrowser/browser/webkit/network/proxy.py similarity index 100% rename from qutebrowser/browser/network/proxy.py rename to qutebrowser/browser/webkit/network/proxy.py diff --git a/qutebrowser/browser/network/qutescheme.py b/qutebrowser/browser/webkit/network/qutescheme.py similarity index 99% rename from qutebrowser/browser/network/qutescheme.py rename to qutebrowser/browser/webkit/network/qutescheme.py index bf653ec6e..c543df291 100644 --- a/qutebrowser/browser/network/qutescheme.py +++ b/qutebrowser/browser/webkit/network/qutescheme.py @@ -33,7 +33,7 @@ from PyQt5.QtNetwork import QNetworkReply import qutebrowser from qutebrowser.browser import pdfjs -from qutebrowser.browser.network import schemehandler, networkreply +from qutebrowser.browser.webkit.network import schemehandler, networkreply from qutebrowser.utils import (version, utils, jinja, log, message, docutils, objreg) from qutebrowser.config import configexc, configdata diff --git a/qutebrowser/browser/network/schemehandler.py b/qutebrowser/browser/webkit/network/schemehandler.py similarity index 100% rename from qutebrowser/browser/network/schemehandler.py rename to qutebrowser/browser/webkit/network/schemehandler.py diff --git a/qutebrowser/browser/rfc6266.py b/qutebrowser/browser/webkit/rfc6266.py similarity index 100% rename from qutebrowser/browser/rfc6266.py rename to qutebrowser/browser/webkit/rfc6266.py diff --git a/qutebrowser/browser/tabhistory.py b/qutebrowser/browser/webkit/tabhistory.py similarity index 100% rename from qutebrowser/browser/tabhistory.py rename to qutebrowser/browser/webkit/tabhistory.py diff --git a/qutebrowser/browser/webelem.py b/qutebrowser/browser/webkit/webelem.py similarity index 100% rename from qutebrowser/browser/webelem.py rename to qutebrowser/browser/webkit/webelem.py diff --git a/qutebrowser/browser/webpage.py b/qutebrowser/browser/webkit/webpage.py similarity index 99% rename from qutebrowser/browser/webpage.py rename to qutebrowser/browser/webkit/webpage.py index 21c8a4ea5..90e96f63b 100644 --- a/qutebrowser/browser/webpage.py +++ b/qutebrowser/browser/webkit/webpage.py @@ -30,8 +30,9 @@ from PyQt5.QtPrintSupport import QPrintDialog from PyQt5.QtWebKitWidgets import QWebPage from qutebrowser.config import config -from qutebrowser.browser import http, tabhistory, pdfjs -from qutebrowser.browser.network import networkmanager +from qutebrowser.browser import pdfjs +from qutebrowser.browser.webkit import http, tabhistory +from qutebrowser.browser.webkit.network import networkmanager from qutebrowser.utils import (message, usertypes, log, jinja, qtutils, utils, objreg, debug, urlutils) diff --git a/qutebrowser/browser/webview.py b/qutebrowser/browser/webkit/webview.py similarity index 99% rename from qutebrowser/browser/webview.py rename to qutebrowser/browser/webkit/webview.py index 70674341c..d8a07aa84 100644 --- a/qutebrowser/browser/webview.py +++ b/qutebrowser/browser/webkit/webview.py @@ -32,7 +32,8 @@ from PyQt5.QtWebKitWidgets import QWebView, QWebPage, QWebFrame from qutebrowser.config import config from qutebrowser.keyinput import modeman from qutebrowser.utils import message, log, usertypes, utils, qtutils, objreg -from qutebrowser.browser import webpage, hints, webelem +from qutebrowser.browser import hints +from qutebrowser.browser.webkit import webpage, webelem LoadStatus = usertypes.enum('LoadStatus', ['none', 'success', 'success_https', diff --git a/qutebrowser/completion/models/miscmodels.py b/qutebrowser/completion/models/miscmodels.py index 4b48290d9..5c730e456 100644 --- a/qutebrowser/completion/models/miscmodels.py +++ b/qutebrowser/completion/models/miscmodels.py @@ -22,7 +22,7 @@ from collections import defaultdict from PyQt5.QtCore import Qt, QTimer, pyqtSlot -from qutebrowser.browser import webview +from qutebrowser.browser.webkit import webview from qutebrowser.config import config, configdata from qutebrowser.utils import objreg, log, qtutils, utils from qutebrowser.commands import cmdutils diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index 20488df57..9c6894c21 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -34,7 +34,8 @@ from qutebrowser.mainwindow import tabbedbrowser from qutebrowser.mainwindow.statusbar import bar from qutebrowser.completion import completionwidget from qutebrowser.keyinput import modeman -from qutebrowser.browser import hints, downloads, downloadview, commands +from qutebrowser.browser import commands, downloadview, hints +from qutebrowser.browser.webkit import downloads from qutebrowser.misc import crashsignal, keyhintwidget diff --git a/qutebrowser/mainwindow/statusbar/percentage.py b/qutebrowser/mainwindow/statusbar/percentage.py index 1f6a05377..ccc1f1ecf 100644 --- a/qutebrowser/mainwindow/statusbar/percentage.py +++ b/qutebrowser/mainwindow/statusbar/percentage.py @@ -22,7 +22,7 @@ from PyQt5.QtCore import pyqtSlot from qutebrowser.mainwindow.statusbar import textbase -from qutebrowser.browser import webview +from qutebrowser.browser.webkit import webview class Percentage(textbase.TextBase): diff --git a/qutebrowser/mainwindow/statusbar/progress.py b/qutebrowser/mainwindow/statusbar/progress.py index 3fd6878a7..ded74ce1a 100644 --- a/qutebrowser/mainwindow/statusbar/progress.py +++ b/qutebrowser/mainwindow/statusbar/progress.py @@ -22,7 +22,7 @@ from PyQt5.QtCore import pyqtSlot, QSize from PyQt5.QtWidgets import QProgressBar, QSizePolicy -from qutebrowser.browser import webview +from qutebrowser.browser.webkit import webview from qutebrowser.config import style from qutebrowser.utils import utils diff --git a/qutebrowser/mainwindow/statusbar/text.py b/qutebrowser/mainwindow/statusbar/text.py index 0a6721b6c..912a3e701 100644 --- a/qutebrowser/mainwindow/statusbar/text.py +++ b/qutebrowser/mainwindow/statusbar/text.py @@ -24,7 +24,7 @@ from PyQt5.QtCore import pyqtSlot from qutebrowser.config import config from qutebrowser.mainwindow.statusbar import textbase from qutebrowser.utils import usertypes, log, objreg -from qutebrowser.browser import webview +from qutebrowser.browser.webkit import webview class Text(textbase.TextBase): diff --git a/qutebrowser/mainwindow/statusbar/url.py b/qutebrowser/mainwindow/statusbar/url.py index 4d8e6e2a0..a4374fb44 100644 --- a/qutebrowser/mainwindow/statusbar/url.py +++ b/qutebrowser/mainwindow/statusbar/url.py @@ -21,7 +21,7 @@ from PyQt5.QtCore import pyqtSlot, pyqtProperty, Qt, QUrl -from qutebrowser.browser import webview +from qutebrowser.browser.webkit import webview from qutebrowser.mainwindow.statusbar import textbase from qutebrowser.config import style from qutebrowser.utils import usertypes diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 45508d051..7afb88b76 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -29,7 +29,8 @@ from PyQt5.QtGui import QIcon from qutebrowser.config import config from qutebrowser.keyinput import modeman from qutebrowser.mainwindow import tabwidget -from qutebrowser.browser import signalfilter, webview +from qutebrowser.browser import signalfilter +from qutebrowser.browser.webkit import webview from qutebrowser.utils import (log, usertypes, utils, qtutils, objreg, urlutils, message) diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index ec9fd7fcb..2c1ab850c 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -29,7 +29,7 @@ from PyQt5.QtGui import QIcon, QPalette, QColor from qutebrowser.utils import qtutils, objreg, utils, usertypes from qutebrowser.config import config -from qutebrowser.browser import webview +from qutebrowser.browser.webkit import webview PixelMetrics = usertypes.enum('PixelMetrics', ['icon_padding'], diff --git a/qutebrowser/misc/sessions.py b/qutebrowser/misc/sessions.py index 420c808af..13d6166f9 100644 --- a/qutebrowser/misc/sessions.py +++ b/qutebrowser/misc/sessions.py @@ -31,7 +31,7 @@ try: except ImportError: # pragma: no cover from yaml import SafeLoader as YamlLoader, SafeDumper as YamlDumper -from qutebrowser.browser import tabhistory +from qutebrowser.browser.webkit import tabhistory from qutebrowser.utils import (standarddir, objreg, qtutils, log, usertypes, message) from qutebrowser.commands import cmdexc, cmdutils diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index b4fe9e764..1de004c90 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -28,7 +28,7 @@ try: except ImportError: hunter = None -from qutebrowser.browser.network import qutescheme +from qutebrowser.browser.webkit.network import qutescheme from qutebrowser.utils import log, objreg, usertypes, message, debug, utils from qutebrowser.commands import cmdutils, runners, cmdexc from qutebrowser.config import style diff --git a/scripts/dev/check_coverage.py b/scripts/dev/check_coverage.py index 8b80dfadf..060c06927 100644 --- a/scripts/dev/check_coverage.py +++ b/scripts/dev/check_coverage.py @@ -47,28 +47,27 @@ PERFECT_FILES = [ ('tests/unit/commands/test_argparser.py', 'qutebrowser/commands/argparser.py'), - ('tests/unit/browser/test_cache.py', - 'qutebrowser/browser/cache.py'), - ('tests/unit/browser/test_cookies.py', - 'qutebrowser/browser/cookies.py'), - ('tests/unit/browser/test_history.py', - 'qutebrowser/browser/history.py'), - ('tests/unit/browser/test_tabhistory.py', - 'qutebrowser/browser/tabhistory.py'), - ('tests/unit/browser/http/test_http.py', - 'qutebrowser/browser/http.py'), - ('tests/unit/browser/http/test_content_disposition.py', - 'qutebrowser/browser/rfc6266.py'), - ('tests/unit/browser/test_webelem.py', - 'qutebrowser/browser/webelem.py'), - ('tests/unit/browser/network/test_schemehandler.py', - 'qutebrowser/browser/network/schemehandler.py'), - ('tests/unit/browser/network/test_filescheme.py', - 'qutebrowser/browser/network/filescheme.py'), - ('tests/unit/browser/network/test_networkreply.py', - 'qutebrowser/browser/network/networkreply.py'), - ('tests/unit/browser/network/test_pastebin.py', - 'qutebrowser/browser/network/pastebin.py'), + ('tests/unit/browser/webkit/test_cache.py', + 'qutebrowser/browser/webkit/cache.py'), + ('tests/unit/browser/webkit/test_cookies.py', + 'qutebrowser/browser/webkit/cookies.py'), + ('tests/unit/browser/webkit/test_history.py', + 'qutebrowser/browser/webkit/history.py'), + ('tests/unit/browser/webkit/test_tabhistory.py', + 'qutebrowser/browser/webkit/tabhistory.py'), + ('tests/unit/browser/webkit/http/test_http.py', + 'qutebrowser/browser/webkit/http.py'), + ('tests/unit/browser/webkit/http/test_content_disposition.py', + 'qutebrowser/browser/webkit/rfc6266.py'), + ('tests/unit/browser/webkit/test_webelem.py', + 'qutebrowser/browser/webkit/webelem.py'), + ('tests/unit/browser/webkit/network/test_schemehandler.py', + 'qutebrowser/browser/webkit/network/schemehandler.py'), + ('tests/unit/browser/webkit/network/test_filescheme.py', + 'qutebrowser/browser/webkit/network/filescheme.py'), + ('tests/unit/browser/webkit/network/test_networkreply.py', + 'qutebrowser/browser/webkit/network/networkreply.py'), + ('tests/unit/browser/test_signalfilter.py', 'qutebrowser/browser/signalfilter.py'), @@ -95,6 +94,8 @@ PERFECT_FILES = [ 'qutebrowser/misc/ipc.py'), ('tests/unit/misc/test_keyhints.py', 'qutebrowser/misc/keyhintwidget.py'), + ('tests/unit/misc/test_pastebin.py', + 'qutebrowser/misc/pastebin.py'), (None, 'qutebrowser/mainwindow/statusbar/keystring.py'), diff --git a/scripts/dev/run_vulture.py b/scripts/dev/run_vulture.py index fb6aef0b3..86415804e 100755 --- a/scripts/dev/run_vulture.py +++ b/scripts/dev/run_vulture.py @@ -32,8 +32,8 @@ import vulture import qutebrowser.app # pylint: disable=unused-import from qutebrowser.commands import cmdutils from qutebrowser.utils import utils -from qutebrowser.browser import rfc6266 -from qutebrowser.browser.network import qutescheme +from qutebrowser.browser.webkit import rfc6266 +from qutebrowser.browser.webkit.network import qutescheme def whitelist_generator(): @@ -46,7 +46,7 @@ def whitelist_generator(): for name, member in inspect.getmembers(rfc6266, inspect.isclass): for attr in ('grammar', 'regex'): if hasattr(member, attr): - yield 'qutebrowser.browser.rfc6266.{}.{}'.format(name, attr) + yield 'qutebrowser.browser.webkit.rfc6266.{}.{}'.format(name, attr) # PyQt properties for attr in ('prompt_active', 'command_active', 'insert_active', @@ -74,13 +74,13 @@ def whitelist_generator(): # qute:... handlers for func in qutescheme.HANDLERS.values(): - yield 'qutebrowser.browser.network.qutescheme.' + func.__name__ + yield 'qutebrowser.browser.webkit.network.qutescheme.' + func.__name__ # Globals # https://bitbucket.org/jendrikseipp/vulture/issues/10/ yield 'qutebrowser.misc.utilcmds.pyeval_output' yield 'utils.use_color' - yield 'qutebrowser.browser.mhtml.last_used_directory' + yield 'qutebrowser.browser.webkit.mhtml.last_used_directory' yield 'qutebrowser.utils.utils.fake_clipboard' yield 'qutebrowser.utils.utils.log_clipboard' diff --git a/tests/end2end/features/keyinput.feature b/tests/end2end/features/keyinput.feature index b2fa4729c..92d1b87fd 100644 --- a/tests/end2end/features/keyinput.feature +++ b/tests/end2end/features/keyinput.feature @@ -157,7 +157,7 @@ Feature: Keyboard input And I wait for "Focus object changed: " in the log And I run :fake-key x And I run :inspector - And I wait for "Focus object changed: " in the log + And I wait for "Focus object changed: " in the log Then the error "No focused webview!" should be shown Scenario: :fake-key sending special key to the website diff --git a/tests/end2end/features/tabs.feature b/tests/end2end/features/tabs.feature index f3745ca7c..0c9417224 100644 --- a/tests/end2end/features/tabs.feature +++ b/tests/end2end/features/tabs.feature @@ -760,7 +760,7 @@ Feature: Tab management And I open data/search.html in a new tab And I open data/scroll.html in a new tab And I run :buffer "Searching text" - And I wait for "Current tab changed, focusing " in the log + And I wait for "Current tab changed, focusing " in the log Then the following tabs should be open: - data/title.html - data/search.html (active) @@ -777,7 +777,7 @@ Feature: Tab management And I open data/caret.html in a new window And I open data/paste_primary.html in a new tab And I run :buffer "Scrolling" - And I wait for "Focus object changed: " in the log + And I wait for "Focus object changed: " in the log Then the session should look like: windows: - active: true @@ -816,7 +816,7 @@ Feature: Tab management And I open data/paste_primary.html in a new tab And I wait until data/caret.html is loaded And I run :buffer "0/2" - And I wait for "Focus object changed: " in the log + And I wait for "Focus object changed: " in the log Then the session should look like: windows: - active: true diff --git a/tests/end2end/fixtures/quteprocess.py b/tests/end2end/fixtures/quteprocess.py index c894acdc3..b79694462 100644 --- a/tests/end2end/fixtures/quteprocess.py +++ b/tests/end2end/fixtures/quteprocess.py @@ -37,7 +37,7 @@ from PyQt5.QtCore import pyqtSignal, QUrl from qutebrowser.misc import ipc from qutebrowser.utils import log, utils -from qutebrowser.browser import webelem +from qutebrowser.browser.webkit import webelem from helpers import utils as testutils from end2end.fixtures import testprocess @@ -193,10 +193,11 @@ class QuteProc(testprocess.Process): self._log(line_to_log) start_okay_message_load = ( - "load status for : LoadStatus.success") + "load status for : LoadStatus.success") start_okay_message_focus = ( - "Focus object changed: ") if (log_line.category == 'ipc' and @@ -432,7 +433,8 @@ class QuteProc(testprocess.Process): assert url pattern = re.compile( - r"(load status for : LoadStatus\.{load_status}|fetch: " r"PyQt5\.QtCore\.QUrl\('{url}'\) -> .*)".format( load_status=re.escape(load_status), url=re.escape(url))) diff --git a/tests/helpers/fixtures.py b/tests/helpers/fixtures.py index 847f47438..5de771514 100644 --- a/tests/helpers/fixtures.py +++ b/tests/helpers/fixtures.py @@ -35,7 +35,7 @@ import pytest import helpers.stubs as stubsmod from qutebrowser.config import config from qutebrowser.utils import objreg -from qutebrowser.browser import cookies +from qutebrowser.browser.webkit import cookies from qutebrowser.misc import savemanager from PyQt5.QtCore import QEvent, QSize, Qt diff --git a/tests/helpers/stubs.py b/tests/helpers/stubs.py index 157690f8d..87c5594c5 100644 --- a/tests/helpers/stubs.py +++ b/tests/helpers/stubs.py @@ -28,7 +28,7 @@ from PyQt5.QtNetwork import (QNetworkRequest, QAbstractNetworkCache, QNetworkCacheMetaData) from PyQt5.QtWidgets import QCommonStyle, QWidget -from qutebrowser.browser import webview +from qutebrowser.browser.webkit import webview from qutebrowser.config import configexc diff --git a/tests/unit/browser/test_adblock.py b/tests/unit/browser/test_adblock.py index 368207c25..f5b54b6cf 100644 --- a/tests/unit/browser/test_adblock.py +++ b/tests/unit/browser/test_adblock.py @@ -18,8 +18,6 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . -"""Tests for qutebrowser.browser.adblock.""" - import os import zipfile import shutil diff --git a/tests/unit/browser/test_commands.py b/tests/unit/browser/test_commands.py index ef9958533..1a06b18c3 100644 --- a/tests/unit/browser/test_commands.py +++ b/tests/unit/browser/test_commands.py @@ -17,8 +17,6 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . -"""Tests for qutebrowser.browser.commands.""" - import collections import pytest diff --git a/tests/unit/browser/test_pdfjs.py b/tests/unit/browser/test_pdfjs.py index 606c480eb..7293ff522 100644 --- a/tests/unit/browser/test_pdfjs.py +++ b/tests/unit/browser/test_pdfjs.py @@ -17,8 +17,6 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . -"""Tests for qutebrowser.browser.pdfjs.""" - import textwrap import pytest diff --git a/tests/unit/browser/http/test_content_disposition.py b/tests/unit/browser/webkit/http/test_content_disposition.py similarity index 99% rename from tests/unit/browser/http/test_content_disposition.py rename to tests/unit/browser/webkit/http/test_content_disposition.py index 4b4d0b78c..7b817c5e9 100644 --- a/tests/unit/browser/http/test_content_disposition.py +++ b/tests/unit/browser/webkit/http/test_content_disposition.py @@ -17,13 +17,11 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . -"""Tests for qutebrowser.browser.http.parse_content_disposition.""" - import logging import pytest -from qutebrowser.browser import http +from qutebrowser.browser.webkit import http DEFAULT_NAME = 'qutebrowser-download' diff --git a/tests/unit/browser/http/test_http.py b/tests/unit/browser/webkit/http/test_http.py similarity index 97% rename from tests/unit/browser/http/test_http.py rename to tests/unit/browser/webkit/http/test_http.py index 0196eee67..42d28f2b9 100644 --- a/tests/unit/browser/http/test_http.py +++ b/tests/unit/browser/webkit/http/test_http.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . -"""Tests for qutebrowser.browser.http. +"""Tests for qutebrowser.browser.webkit.http. Note that tests for parse_content_disposition are in their own test_content_disposition.py file. @@ -26,7 +26,7 @@ test_content_disposition.py file. import pytest from PyQt5.QtCore import QUrl -from qutebrowser.browser import http +from qutebrowser.browser.webkit import http class TestNoContentDisposition: diff --git a/tests/unit/browser/http/test_http_hypothesis.py b/tests/unit/browser/webkit/http/test_http_hypothesis.py similarity index 95% rename from tests/unit/browser/http/test_http_hypothesis.py rename to tests/unit/browser/webkit/http/test_http_hypothesis.py index 182aae78b..1fb4dd835 100644 --- a/tests/unit/browser/http/test_http_hypothesis.py +++ b/tests/unit/browser/webkit/http/test_http_hypothesis.py @@ -17,15 +17,13 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . -"""Hypothesis tests for qutebrowser.browser.http.""" - import logging import pytest import hypothesis from hypothesis import strategies -from qutebrowser.browser import http, rfc6266 +from qutebrowser.browser.webkit import http, rfc6266 @pytest.mark.parametrize('template', [ diff --git a/tests/unit/browser/network/test_filescheme.py b/tests/unit/browser/webkit/network/test_filescheme.py similarity index 97% rename from tests/unit/browser/network/test_filescheme.py rename to tests/unit/browser/webkit/network/test_filescheme.py index 3fcdc4f6e..9d5f46c31 100644 --- a/tests/unit/browser/network/test_filescheme.py +++ b/tests/unit/browser/webkit/network/test_filescheme.py @@ -17,8 +17,6 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . -"""Tests for qutebrowser.browser.network.filescheme.""" - import os import collections @@ -27,7 +25,7 @@ import bs4 from PyQt5.QtCore import QUrl from PyQt5.QtNetwork import QNetworkRequest -from qutebrowser.browser.network import filescheme +from qutebrowser.browser.webkit.network import filescheme from qutebrowser.utils import urlutils @@ -228,7 +226,8 @@ class TestDirbrowserHtml: assert not parsed.parent def test_oserror(self, mocker): - m = mocker.patch('qutebrowser.browser.network.filescheme.os.listdir') + m = mocker.patch('qutebrowser.browser.webkit.network.filescheme.' + 'os.listdir') m.side_effect = OSError('Error message') html = filescheme.dirbrowser_html('') soup = bs4.BeautifulSoup(html, 'html.parser') diff --git a/tests/unit/browser/network/test_networkmanager.py b/tests/unit/browser/webkit/network/test_networkmanager.py similarity index 91% rename from tests/unit/browser/network/test_networkmanager.py rename to tests/unit/browser/webkit/network/test_networkmanager.py index f271da630..4ac93435d 100644 --- a/tests/unit/browser/network/test_networkmanager.py +++ b/tests/unit/browser/webkit/network/test_networkmanager.py @@ -17,12 +17,10 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . -"""Tests for qutebrowser.browser.networkmanager.""" - import pytest -from qutebrowser.browser.network import networkmanager -from qutebrowser.browser import cookies +from qutebrowser.browser.webkit.network import networkmanager +from qutebrowser.browser.webkit import cookies pytestmark = pytest.mark.usefixtures('cookiejar_and_cache') diff --git a/tests/unit/browser/network/test_networkreply.py b/tests/unit/browser/webkit/network/test_networkreply.py similarity index 98% rename from tests/unit/browser/network/test_networkreply.py rename to tests/unit/browser/webkit/network/test_networkreply.py index bca374d2f..a270eebc3 100644 --- a/tests/unit/browser/network/test_networkreply.py +++ b/tests/unit/browser/webkit/network/test_networkreply.py @@ -24,7 +24,7 @@ import pytest from PyQt5.QtCore import QUrl, QIODevice from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply -from qutebrowser.browser.network import networkreply +from qutebrowser.browser.webkit.network import networkreply @pytest.fixture diff --git a/tests/unit/browser/network/test_qutescheme.py b/tests/unit/browser/webkit/network/test_qutescheme.py similarity index 95% rename from tests/unit/browser/network/test_qutescheme.py rename to tests/unit/browser/webkit/network/test_qutescheme.py index 1dede5d72..37fb3b262 100644 --- a/tests/unit/browser/network/test_qutescheme.py +++ b/tests/unit/browser/webkit/network/test_qutescheme.py @@ -17,8 +17,6 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . -"""Tests for qutebrowser.browser.network.qutescheme.""" - import pytest import logging @@ -26,7 +24,7 @@ from PyQt5.QtCore import QUrl from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply from qutebrowser.browser import pdfjs -from qutebrowser.browser.network import qutescheme +from qutebrowser.browser.webkit.network import qutescheme @pytest.fixture diff --git a/tests/unit/browser/network/test_schemehandler.py b/tests/unit/browser/webkit/network/test_schemehandler.py similarity index 94% rename from tests/unit/browser/network/test_schemehandler.py rename to tests/unit/browser/webkit/network/test_schemehandler.py index 921dfc124..d981b8412 100644 --- a/tests/unit/browser/network/test_schemehandler.py +++ b/tests/unit/browser/webkit/network/test_schemehandler.py @@ -21,7 +21,7 @@ import pytest -from qutebrowser.browser.network import schemehandler +from qutebrowser.browser.webkit.network import schemehandler def test_init(): diff --git a/tests/unit/browser/test_cache.py b/tests/unit/browser/webkit/test_cache.py similarity index 99% rename from tests/unit/browser/test_cache.py rename to tests/unit/browser/webkit/test_cache.py index 6d9254d16..1d9b8a684 100644 --- a/tests/unit/browser/test_cache.py +++ b/tests/unit/browser/webkit/test_cache.py @@ -17,12 +17,10 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . -"""Tests for qutebrowser.browser.cache.""" - from PyQt5.QtCore import QUrl, QDateTime from PyQt5.QtNetwork import QNetworkDiskCache, QNetworkCacheMetaData -from qutebrowser.browser import cache +from qutebrowser.browser.webkit import cache def preload_cache(cache, url='http://www.example.com/', content=b'foobar'): diff --git a/tests/unit/browser/test_cookies.py b/tests/unit/browser/webkit/test_cookies.py similarity index 98% rename from tests/unit/browser/test_cookies.py rename to tests/unit/browser/webkit/test_cookies.py index 28f92ac59..2d764af42 100644 --- a/tests/unit/browser/test_cookies.py +++ b/tests/unit/browser/webkit/test_cookies.py @@ -17,13 +17,11 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . -"""Tests for qutebrowser.browser.cookies.""" - from PyQt5.QtNetwork import QNetworkCookie from PyQt5.QtCore import QUrl import pytest -from qutebrowser.browser import cookies +from qutebrowser.browser.webkit import cookies from qutebrowser.misc import lineparser CONFIG_ALL_COOKIES = {'content': {'cookies-accept': 'all'}} diff --git a/tests/unit/browser/test_history.py b/tests/unit/browser/webkit/test_history.py similarity index 99% rename from tests/unit/browser/test_history.py rename to tests/unit/browser/webkit/test_history.py index 4c3c85769..dbc2c6950 100644 --- a/tests/unit/browser/test_history.py +++ b/tests/unit/browser/webkit/test_history.py @@ -28,7 +28,7 @@ from hypothesis import strategies from PyQt5.QtCore import QUrl from PyQt5.QtWebKit import QWebHistoryInterface -from qutebrowser.browser import history +from qutebrowser.browser.webkit import history from qutebrowser.utils import objreg diff --git a/tests/unit/browser/test_mhtml.py b/tests/unit/browser/webkit/test_mhtml.py similarity index 98% rename from tests/unit/browser/test_mhtml.py rename to tests/unit/browser/webkit/test_mhtml.py index 6cf597a4b..fced28875 100644 --- a/tests/unit/browser/test_mhtml.py +++ b/tests/unit/browser/webkit/test_mhtml.py @@ -17,15 +17,13 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . -"""Tests for qutebrowser.browser.mhtml.""" - import io import textwrap import re import pytest -from qutebrowser.browser import mhtml +from qutebrowser.browser.webkit import mhtml @pytest.fixture(autouse=True) @@ -269,7 +267,7 @@ def test_empty_content_type(checker): def test_css_url_scanner(monkeypatch, has_cssutils, inline, style, expected_urls): if not has_cssutils: - monkeypatch.setattr('qutebrowser.browser.mhtml.cssutils', None) + monkeypatch.setattr('qutebrowser.browser.webkit.mhtml.cssutils', None) expected_urls.sort() urls = mhtml._get_css_imports(style, inline=inline) urls.sort() diff --git a/tests/unit/browser/test_qt_javascript.py b/tests/unit/browser/webkit/test_qt_javascript.py similarity index 100% rename from tests/unit/browser/test_qt_javascript.py rename to tests/unit/browser/webkit/test_qt_javascript.py diff --git a/tests/unit/browser/test_tabhistory.py b/tests/unit/browser/webkit/test_tabhistory.py similarity index 97% rename from tests/unit/browser/test_tabhistory.py rename to tests/unit/browser/webkit/test_tabhistory.py index 814fc1c65..f6cce419f 100644 --- a/tests/unit/browser/test_tabhistory.py +++ b/tests/unit/browser/webkit/test_tabhistory.py @@ -24,8 +24,8 @@ import collections from PyQt5.QtCore import QUrl, QPoint import pytest -from qutebrowser.browser import tabhistory -from qutebrowser.browser.tabhistory import TabHistoryItem as Item +from qutebrowser.browser.webkit import tabhistory +from qutebrowser.browser.webkit.tabhistory import TabHistoryItem as Item from qutebrowser.utils import qtutils diff --git a/tests/unit/browser/test_webelem.py b/tests/unit/browser/webkit/test_webelem.py similarity index 98% rename from tests/unit/browser/test_webelem.py rename to tests/unit/browser/webkit/test_webelem.py index 2eb484dc8..7f42275fe 100644 --- a/tests/unit/browser/test_webelem.py +++ b/tests/unit/browser/webkit/test_webelem.py @@ -32,7 +32,7 @@ from PyQt5.QtCore import PYQT_VERSION, QRect, QPoint from PyQt5.QtWebKit import QWebElement import pytest -from qutebrowser.browser import webelem +from qutebrowser.browser.webkit import webelem def get_webelem(geometry=None, frame=None, *, null=False, style=None, @@ -274,9 +274,9 @@ class TestWebElementWrapper: assert str(elem) == 'text' @pytest.mark.parametrize('is_null, expected', [ - (False, ""), - (True, ''), + (True, ''), ]) def test_repr(self, elem, is_null, expected): elem._elem.isNull.return_value = is_null @@ -619,7 +619,8 @@ class TestRectOnView: This is needed for all the tests calling rect_on_view or is_visible. """ config_stub.data = {'ui': {'zoom-text-only': 'true'}} - monkeypatch.setattr('qutebrowser.browser.webelem.config', config_stub) + monkeypatch.setattr('qutebrowser.browser.webkit.webelem.config', + config_stub) return config_stub @pytest.mark.parametrize('js_rect', [ @@ -846,7 +847,8 @@ class TestIsEditable: def stubbed_config(self, config_stub, monkeypatch): """Fixture to create a config stub with an input section.""" config_stub.data = {'input': {}} - monkeypatch.setattr('qutebrowser.browser.webelem.config', config_stub) + monkeypatch.setattr('qutebrowser.browser.webkit.webelem.config', + config_stub) return config_stub @pytest.mark.parametrize('tagname, attributes, editable', [ diff --git a/tests/unit/browser/test_webelem_jsescape.html b/tests/unit/browser/webkit/test_webelem_jsescape.html similarity index 100% rename from tests/unit/browser/test_webelem_jsescape.html rename to tests/unit/browser/webkit/test_webelem_jsescape.html diff --git a/tests/unit/mainwindow/statusbar/test_progress.py b/tests/unit/mainwindow/statusbar/test_progress.py index 0b1a64967..b90c0814c 100644 --- a/tests/unit/mainwindow/statusbar/test_progress.py +++ b/tests/unit/mainwindow/statusbar/test_progress.py @@ -24,7 +24,7 @@ from collections import namedtuple import pytest -from qutebrowser.browser import webview +from qutebrowser.browser.webkit import webview from qutebrowser.mainwindow.statusbar.progress import Progress diff --git a/tests/unit/mainwindow/statusbar/test_url.py b/tests/unit/mainwindow/statusbar/test_url.py index 588ad2672..67c0dea7a 100644 --- a/tests/unit/mainwindow/statusbar/test_url.py +++ b/tests/unit/mainwindow/statusbar/test_url.py @@ -23,7 +23,7 @@ import pytest import collections -from qutebrowser.browser import webview +from qutebrowser.browser.webkit import webview from qutebrowser.mainwindow.statusbar import url diff --git a/tests/unit/misc/test_sessions.py b/tests/unit/misc/test_sessions.py index 580b95831..d1f60aef4 100644 --- a/tests/unit/misc/test_sessions.py +++ b/tests/unit/misc/test_sessions.py @@ -30,8 +30,8 @@ from PyQt5.QtWebKitWidgets import QWebView from qutebrowser.misc import sessions from qutebrowser.utils import objreg, qtutils -from qutebrowser.browser import tabhistory -from qutebrowser.browser.tabhistory import TabHistoryItem as Item +from qutebrowser.browser.webkit import tabhistory +from qutebrowser.browser.webkit.tabhistory import TabHistoryItem as Item from qutebrowser.commands import cmdexc