Split browser into browser/browser.webkit
This commit is contained in:
parent
f70a75978b
commit
4fccc89d7d
2
.flake8
2
.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-]+ .*
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,6 +1,6 @@
|
||||
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
||||
|
||||
# Copyright 2014-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
||||
# Copyright 2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
||||
#
|
||||
# This file is part of qutebrowser.
|
||||
#
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
20
qutebrowser/browser/webkit/__init__.py
Normal file
20
qutebrowser/browser/webkit/__init__.py
Normal file
@ -0,0 +1,20 @@
|
||||
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
||||
|
||||
# Copyright 2014-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""Classes related to the browser widgets for QtWebKit."""
|
@ -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,
|
@ -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
|
||||
|
@ -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:
|
@ -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
|
||||
|
||||
|
@ -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%'
|
@ -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
|
@ -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)
|
||||
|
@ -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',
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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):
|
||||
|
@ -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
|
||||
|
||||
|
@ -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):
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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'],
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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'),
|
||||
|
@ -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'
|
||||
|
||||
|
@ -157,7 +157,7 @@ Feature: Keyboard input
|
||||
And I wait for "Focus object changed: <PyQt5.QtWebKitWidgets.QWebView object at *>" in the log
|
||||
And I run :fake-key x
|
||||
And I run :inspector
|
||||
And I wait for "Focus object changed: <qutebrowser.browser.webview.WebView *>" in the log
|
||||
And I wait for "Focus object changed: <qutebrowser.browser.webkit.webview.WebView *>" in the log
|
||||
Then the error "No focused webview!" should be shown
|
||||
|
||||
Scenario: :fake-key sending special key to the website
|
||||
|
@ -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 <qutebrowser.browser.webview.WebView tab_id=* url='http://localhost:*/data/search.html'>" in the log
|
||||
And I wait for "Current tab changed, focusing <qutebrowser.browser.webkit.webview.WebView tab_id=* url='http://localhost:*/data/search.html'>" 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: <qutebrowser.browser.webview.WebView tab_id=* url='http://localhost:*/data/scroll.html'>" in the log
|
||||
And I wait for "Focus object changed: <qutebrowser.browser.webkit.webview.WebView tab_id=* url='http://localhost:*/data/scroll.html'>" 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: <qutebrowser.browser.webview.WebView tab_id=* url='http://localhost:*/data/search.html'>" in the log
|
||||
And I wait for "Focus object changed: <qutebrowser.browser.webkit.webview.WebView tab_id=* url='http://localhost:*/data/search.html'>" in the log
|
||||
Then the session should look like:
|
||||
windows:
|
||||
- active: true
|
||||
|
@ -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 <qutebrowser.browser.webview.WebView tab_id=0 "
|
||||
"url='about:blank'>: LoadStatus.success")
|
||||
"load status for <qutebrowser.browser.webkit.webview.WebView "
|
||||
"tab_id=0 url='about:blank'>: LoadStatus.success")
|
||||
start_okay_message_focus = (
|
||||
"Focus object changed: <qutebrowser.browser.webview.WebView "
|
||||
"Focus object changed: "
|
||||
"<qutebrowser.browser.webkit.webview.WebView "
|
||||
"tab_id=0 url='about:blank'>")
|
||||
|
||||
if (log_line.category == 'ipc' and
|
||||
@ -432,7 +433,8 @@ class QuteProc(testprocess.Process):
|
||||
assert url
|
||||
|
||||
pattern = re.compile(
|
||||
r"(load status for <qutebrowser\.browser\.webview\.WebView "
|
||||
r"(load status for "
|
||||
r"<qutebrowser\.browser\.webkit\.webview\.WebView "
|
||||
r"tab_id=\d+ url='{url}/?'>: LoadStatus\.{load_status}|fetch: "
|
||||
r"PyQt5\.QtCore\.QUrl\('{url}'\) -> .*)".format(
|
||||
load_status=re.escape(load_status), url=re.escape(url)))
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -18,8 +18,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""Tests for qutebrowser.browser.adblock."""
|
||||
|
||||
import os
|
||||
import zipfile
|
||||
import shutil
|
||||
|
@ -17,8 +17,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""Tests for qutebrowser.browser.commands."""
|
||||
|
||||
import collections
|
||||
|
||||
import pytest
|
||||
|
@ -17,8 +17,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""Tests for qutebrowser.browser.pdfjs."""
|
||||
|
||||
import textwrap
|
||||
|
||||
import pytest
|
||||
|
@ -17,13 +17,11 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""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'
|
@ -17,7 +17,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""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:
|
@ -17,15 +17,13 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""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', [
|
@ -17,8 +17,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""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')
|
@ -17,12 +17,10 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""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')
|
||||
|
@ -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
|
@ -17,8 +17,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""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
|
@ -21,7 +21,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
from qutebrowser.browser.network import schemehandler
|
||||
from qutebrowser.browser.webkit.network import schemehandler
|
||||
|
||||
|
||||
def test_init():
|
@ -17,12 +17,10 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""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'):
|
@ -17,13 +17,11 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""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'}}
|
@ -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
|
||||
|
||||
|
@ -17,15 +17,13 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""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()
|
@ -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
|
||||
|
||||
|
@ -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, "<qutebrowser.browser.webelem.WebElementWrapper "
|
||||
(False, "<qutebrowser.browser.webkit.webelem.WebElementWrapper "
|
||||
"html='<fakeelem/>'>"),
|
||||
(True, '<qutebrowser.browser.webelem.WebElementWrapper html=None>'),
|
||||
(True, '<qutebrowser.browser.webkit.webelem.WebElementWrapper html=None>'),
|
||||
])
|
||||
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', [
|
@ -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
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user