This commit is contained in:
Florian Bruhin 2018-11-28 13:01:43 +01:00
parent 14fe7f9b0b
commit b5253ec473
9 changed files with 12 additions and 10 deletions

View File

@ -193,7 +193,7 @@ def _init_icon():
icon = QIcon() icon = QIcon()
fallback_icon = QIcon() fallback_icon = QIcon()
for size in [16, 24, 32, 48, 64, 96, 128, 256, 512]: for size in [16, 24, 32, 48, 64, 96, 128, 256, 512]:
filename = ':/icons/qutebrowser-{}x{}.png'.format(size, size) filename = ':/icons/qutebrowser-{size}x{size}.png'.format(size=size)
pixmap = QPixmap(filename) pixmap = QPixmap(filename)
if pixmap.isNull(): if pixmap.isNull():
log.init.warning("Failed to load {}".format(filename)) log.init.warning("Failed to load {}".format(filename))

View File

@ -280,6 +280,7 @@ class BackendImports:
def _try_import_backends(): def _try_import_backends():
"""Check whether backends can be imported and return BackendImports.""" """Check whether backends can be imported and return BackendImports."""
# pylint: disable=unused-import
results = BackendImports() results = BackendImports()
try: try:

View File

@ -133,7 +133,7 @@ def init_faulthandler(fileobj=sys.__stderr__):
def check_pyqt_core(): def check_pyqt_core():
"""Check if PyQt core is installed.""" """Check if PyQt core is installed."""
try: try:
import PyQt5.QtCore import PyQt5.QtCore # pylint: disable=unused-import
except ImportError as e: except ImportError as e:
text = _missing_str('PyQt5') text = _missing_str('PyQt5')
text = text.replace('<b>', '') text = text.replace('<b>', '')
@ -188,7 +188,7 @@ def check_qt_version():
def check_ssl_support(): def check_ssl_support():
"""Check if SSL support is available.""" """Check if SSL support is available."""
try: try:
from PyQt5.QtNetwork import QSslSocket from PyQt5.QtNetwork import QSslSocket # pylint: disable=unused-import
except ImportError: except ImportError:
_die("Fatal error: Your Qt is built without SSL support.") _die("Fatal error: Your Qt is built without SSL support.")

View File

@ -370,7 +370,7 @@ def main():
if args.upload is not None: if args.upload is not None:
# Fail early when trying to upload without github3 installed # Fail early when trying to upload without github3 installed
# or without API token # or without API token
import github3 import github3 # pylint: disable=unused-import
read_github_token() read_github_token()
if args.no_asciidoc: if args.no_asciidoc:

View File

@ -135,7 +135,7 @@ def _get_command_quickref(cmds):
out.append('|Command|Description') out.append('|Command|Description')
for name, cmd in cmds: for name, cmd in cmds:
desc = inspect.getdoc(cmd.handler).splitlines()[0] desc = inspect.getdoc(cmd.handler).splitlines()[0]
out.append('|<<{},{}>>|{}'.format(name, name, desc)) out.append('|<<{name},{name}>>|{desc}'.format(name=name, desc=desc))
out.append('|==============') out.append('|==============')
return '\n'.join(out) return '\n'.join(out)

View File

@ -82,7 +82,8 @@ class Request(testprocess.Line):
for i in range(15): for i in range(15):
path_to_statuses['/redirect/{}'.format(i)] = [HTTPStatus.FOUND] path_to_statuses['/redirect/{}'.format(i)] = [HTTPStatus.FOUND]
for suffix in ['', '1', '2', '3', '4', '5', '6']: for suffix in ['', '1', '2', '3', '4', '5', '6']:
key = '/basic-auth/user{}/password{}'.format(suffix, suffix) key = ('/basic-auth/user{suffix}/password{suffix}'
.format(suffix=suffix))
path_to_statuses[key] = [HTTPStatus.UNAUTHORIZED, HTTPStatus.OK] path_to_statuses[key] = [HTTPStatus.UNAUTHORIZED, HTTPStatus.OK]
default_statuses = [HTTPStatus.OK, HTTPStatus.NOT_MODIFIED] default_statuses = [HTTPStatus.OK, HTTPStatus.NOT_MODIFIED]

View File

@ -82,14 +82,14 @@ def test_generate_pdfjs_script_disable_object_url(monkeypatch,
if qt == 'new': if qt == 'new':
monkeypatch.setattr(pdfjs.qtutils, 'version_check', monkeypatch.setattr(pdfjs.qtutils, 'version_check',
lambda version, exact=False, compiled=True: lambda version, exact=False, compiled=True:
False if version == '5.7.1' else True) version != '5.7.1')
elif qt == 'old': elif qt == 'old':
monkeypatch.setattr(pdfjs.qtutils, 'version_check', monkeypatch.setattr(pdfjs.qtutils, 'version_check',
lambda version, exact=False, compiled=True: False) lambda version, exact=False, compiled=True: False)
elif qt == '5.7': elif qt == '5.7':
monkeypatch.setattr(pdfjs.qtutils, 'version_check', monkeypatch.setattr(pdfjs.qtutils, 'version_check',
lambda version, exact=False, compiled=True: lambda version, exact=False, compiled=True:
True if version == '5.7.1' else False) version == '5.7.1')
else: else:
raise utils.Unreachable raise utils.Unreachable

View File

@ -31,7 +31,7 @@ from qutebrowser.browser.webkit import http, rfc6266
'attachment; filename="{}"', 'attachment; filename="{}"',
'inline; {}', 'inline; {}',
'attachment; {}="foo"', 'attachment; {}="foo"',
'attachment; filename*=iso-8859-1''{}', "attachment; filename*=iso-8859-1''{}",
'attachment; filename*={}', 'attachment; filename*={}',
]) ])
@hypothesis.given(strategies.text(alphabet=[chr(x) for x in range(255)])) @hypothesis.given(strategies.text(alphabet=[chr(x) for x in range(255)]))

View File

@ -73,7 +73,7 @@ def test_patched_errwindow(capfd, mocker, monkeypatch):
monkeypatch.setattr(checkpyver.sys, 'exit', lambda status: None) monkeypatch.setattr(checkpyver.sys, 'exit', lambda status: None)
try: try:
import tkinter import tkinter # pylint: disable=unused-import
except ImportError: except ImportError:
tk_mock = mocker.patch('qutebrowser.misc.checkpyver.Tk', tk_mock = mocker.patch('qutebrowser.misc.checkpyver.Tk',
spec=['withdraw'], new_callable=mocker.Mock) spec=['withdraw'], new_callable=mocker.Mock)