Merge branch 'master' of https://github.com/The-Compiler/qutebrowser
This commit is contained in:
commit
108f0e9073
@ -3,10 +3,10 @@
|
||||
[MASTER]
|
||||
ignore=resources.py
|
||||
extension-pkg-whitelist=PyQt5,sip
|
||||
load-plugins=pylint_checkers.config,
|
||||
pylint_checkers.modeline,
|
||||
pylint_checkers.openencoding,
|
||||
pylint_checkers.settrace
|
||||
load-plugins=qute_pylint.config,
|
||||
qute_pylint.modeline,
|
||||
qute_pylint.openencoding,
|
||||
qute_pylint.settrace
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
enable=all
|
||||
|
@ -677,6 +677,7 @@ class HintManager(QObject):
|
||||
if not elems:
|
||||
raise cmdexc.CommandError("No elements found.")
|
||||
hints = self._hint_strings(elems)
|
||||
log.hints.debug("hints: {}".format(', '.join(hints)))
|
||||
for e, hint in zip(elems, hints):
|
||||
label = self._draw_label(e, hint)
|
||||
self._context.elems[hint] = ElemTuple(e, label)
|
||||
|
25
scripts/dev/pylint_checkers/setup.py
Normal file
25
scripts/dev/pylint_checkers/setup.py
Normal file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
||||
|
||||
# Copyright 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/>.
|
||||
|
||||
"""This is only here so we can install those plugins in tox.ini easily."""
|
||||
|
||||
from setuptools import setup
|
||||
setup(name='qute_pylint', packages=['qute_pylint'])
|
@ -28,7 +28,8 @@ import pytest_mock
|
||||
import pytest_catchlog
|
||||
import pytest_instafail
|
||||
import pytest_faulthandler
|
||||
import pytest_xvfb
|
||||
|
||||
sys.exit(pytest.main(plugins=[pytestqt.plugin, pytest_mock,
|
||||
pytest_catchlog, pytest_instafail,
|
||||
pytest_faulthandler]))
|
||||
pytest_faulthandler, pytest_xvfb]))
|
||||
|
@ -60,7 +60,7 @@ def main():
|
||||
]
|
||||
|
||||
toxinidir = sys.argv[1]
|
||||
pythonpath = os.environ['PYTHONPATH'].split(os.pathsep) + [
|
||||
pythonpath = os.environ.get('PYTHONPATH', '').split(os.pathsep) + [
|
||||
toxinidir,
|
||||
]
|
||||
|
||||
|
13
tests/integration/data/hints/html/simple.html
Normal file
13
tests/integration/data/hints/html/simple.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<!-- target: hello.txt -->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Simple link</title>
|
||||
</head>
|
||||
<body>
|
||||
<a href="/data/hello.txt">Follow me!</a>
|
||||
</body>
|
||||
</html>
|
@ -212,12 +212,7 @@ def path_should_be_loaded(quteproc, path):
|
||||
This is usally the better check compared to "should be requested" as the
|
||||
page could be loaded from local cache.
|
||||
"""
|
||||
url = quteproc.path_to_url(path)
|
||||
pattern = re.compile(
|
||||
r"load status for <qutebrowser\.browser\.webview\.WebView "
|
||||
r"tab_id=\d+ url='{url}/?'>: LoadStatus\.success".format(
|
||||
url=re.escape(url)))
|
||||
quteproc.wait_for(message=pattern)
|
||||
quteproc.wait_for_load_finished(path)
|
||||
|
||||
|
||||
@bdd.then(bdd.parsers.parse("{path} should be requested"))
|
||||
|
@ -380,7 +380,7 @@ class QuteProc(testprocess.Process):
|
||||
url = utils.elide(QUrl(url).toDisplayString(QUrl.EncodeUnicode), 100)
|
||||
pattern = re.compile(
|
||||
r"(load status for <qutebrowser\.browser\.webview\.WebView "
|
||||
r"tab_id=\d+ url='{url}'>: LoadStatus\.{load_status}|fetch: "
|
||||
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)))
|
||||
self.wait_for(message=pattern, timeout=timeout)
|
||||
|
56
tests/integration/test_hints_html.py
Normal file
56
tests/integration/test_hints_html.py
Normal file
@ -0,0 +1,56 @@
|
||||
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
||||
|
||||
# Copyright 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/>.
|
||||
|
||||
"""Test hints based on html files with special comments."""
|
||||
|
||||
import os
|
||||
import os.path
|
||||
|
||||
import yaml
|
||||
import pytest
|
||||
import bs4
|
||||
|
||||
|
||||
def collect_tests():
|
||||
basedir = os.path.dirname(__file__)
|
||||
datadir = os.path.join(basedir, 'data', 'hints', 'html')
|
||||
files = os.listdir(datadir)
|
||||
return files
|
||||
|
||||
|
||||
@pytest.mark.parametrize('test_name', collect_tests())
|
||||
def test_hints(test_name, quteproc):
|
||||
file_path = os.path.join(os.path.abspath(os.path.dirname(__file__)),
|
||||
'data', 'hints', 'html', test_name)
|
||||
url_path = 'data/hints/html/{}'.format(test_name)
|
||||
quteproc.open_path(url_path)
|
||||
quteproc.wait_for_load_finished(url_path)
|
||||
|
||||
with open(file_path, 'r', encoding='utf-8') as html:
|
||||
soup = bs4.BeautifulSoup(html, 'html.parser')
|
||||
|
||||
comment = soup.find(text=lambda text: isinstance(text, bs4.Comment))
|
||||
parsed = yaml.load(comment)
|
||||
|
||||
assert set(parsed.keys()) == {'target'}
|
||||
|
||||
quteproc.send_cmd(':hint links normal')
|
||||
quteproc.wait_for(message='hints: a', category='hints')
|
||||
quteproc.send_cmd(':follow-hint a')
|
||||
quteproc.wait_for_load_finished('data/' + parsed['target'])
|
8
tox.ini
8
tox.ini
@ -20,7 +20,7 @@ deps =
|
||||
Flask==0.10.1
|
||||
glob2==0.4.1
|
||||
httpbin==0.4.1
|
||||
hypothesis==2.0.0
|
||||
hypothesis==3.0.2
|
||||
itsdangerous==0.24
|
||||
Mako==1.0.3
|
||||
parse==1.6.6
|
||||
@ -122,8 +122,6 @@ commands =
|
||||
[testenv:pylint]
|
||||
basepython = python3
|
||||
ignore_errors = true
|
||||
skip_install = true
|
||||
setenv = PYTHONPATH={toxinidir}/scripts/dev
|
||||
passenv =
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
@ -131,6 +129,7 @@ deps =
|
||||
astroid==1.4.4
|
||||
pylint==1.5.4
|
||||
requests==2.9.1
|
||||
./scripts/dev/pylint_checkers
|
||||
commands =
|
||||
{envpython} scripts/link_pyqt.py --tox {envdir}
|
||||
{envpython} -m pylint scripts qutebrowser --output-format=colorized --reports=no
|
||||
@ -138,14 +137,13 @@ commands =
|
||||
|
||||
[testenv:pylint-tip]
|
||||
basepython = python3
|
||||
skip_install = true
|
||||
setenv = {[testenv:pylint]setenv}
|
||||
passenv = {[testenv:pylint]passenv}
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
{[testenv:misc]deps}
|
||||
hg+https://bitbucket.org/logilab/astroid
|
||||
hg+https://bitbucket.org/logilab/pylint
|
||||
./scripts/dev/pylint_checkers
|
||||
commands =
|
||||
{envpython} scripts/link_pyqt.py --tox {envdir}
|
||||
{envpython} -m pylint scripts qutebrowser --output-format=colorized --reports=no
|
||||
|
Loading…
Reference in New Issue
Block a user