Move coverage to QtWebEngine environment with PyPI-PyQt

This commit is contained in:
Florian Bruhin 2017-09-10 01:14:52 +02:00
parent 49a389542e
commit b4f30f6df2
10 changed files with 47 additions and 56 deletions

View File

@ -5,8 +5,6 @@ group: edge
matrix:
include:
- os: linux
env: TESTENV=py34-cov
- os: linux
env: DOCKER=debian-jessie
services: docker
@ -30,7 +28,7 @@ matrix:
env: TESTENV=py35-pyqt59
- os: linux
python: 3.6
env: TESTENV=py36-pyqt59
env: TESTENV=py36-pyqt59-cov
- os: osx
env: TESTENV=py36 OSX=elcapitan
osx_image: xcode7.3

View File

@ -173,9 +173,7 @@ class WebHistory(sql.SqlTable):
(hidden in completion)
atime: Override the atime used to add the entry
"""
if not url.isValid(): # pragma: no cover
# the no cover pragma is a WORKAROUND for this not being covered in
# old Qt versions.
if not url.isValid():
log.misc.warning("Ignoring invalid URL being added to history")
return
@ -320,6 +318,6 @@ def init(parent=None):
history = WebHistory(parent=parent)
objreg.register('web-history', history)
if objects.backend == usertypes.Backend.QtWebKit:
if objects.backend == usertypes.Backend.QtWebKit: # pragma: no cover
from qutebrowser.browser.webkit import webkithistory
webkithistory.init(history)

View File

@ -41,7 +41,7 @@ class CertificateErrorWrapper(usertypes.AbstractCertificateErrorWrapper):
try:
# Qt >= 5.4
return hash(self._error)
except TypeError: # pragma: no cover
except TypeError:
return hash((self._error.certificate().toDer(),
self._error.error()))

View File

@ -30,7 +30,6 @@ class Backforward(textbase.TextBase):
"""Called on URL changes."""
tab = tabs.currentWidget()
if tab is None: # pragma: no cover
# WORKAROUND: Doesn't get tested on older PyQt
self.setText('')
self.hide()
return

View File

@ -245,8 +245,7 @@ class WrapperLayout(QLayout):
def sizeHint(self):
return self._widget.sizeHint()
def itemAt(self, _index): # pragma: no cover
# For some reason this sometimes gets called by Qt.
def itemAt(self, _index):
return None
def takeAt(self, _index):

View File

@ -605,7 +605,7 @@ def safe_display_string(qurl):
raise InvalidUrlError(qurl)
host = qurl.host(QUrl.FullyEncoded)
if '..' in host:
if '..' in host: # pragma: no cover
# WORKAROUND for https://bugreports.qt.io/browse/QTBUG-60364
return '(unparseable URL!) {}'.format(qurl.toDisplayString())

View File

@ -53,8 +53,6 @@ PERFECT_FILES = [
'browser/webkit/cookies.py'),
('tests/unit/browser/test_history.py',
'browser/history.py'),
('tests/unit/browser/test_history.py',
'browser/webkit/webkithistory.py'),
('tests/unit/browser/webkit/http/test_http.py',
'browser/webkit/http.py'),
('tests/unit/browser/webkit/http/test_content_disposition.py',
@ -73,7 +71,7 @@ PERFECT_FILES = [
('tests/unit/browser/test_signalfilter.py',
'browser/signalfilter.py'),
(None,
'browser/webkit/certificateerror.py'),
'browser/webengine/certificateerror.py'),
# ('tests/unit/browser/test_tab.py',
# 'browser/tab.py'),
@ -272,8 +270,8 @@ def main_check():
subprocess.check_call([sys.executable, '-m', 'coverage', 'report',
'--show-missing', '--include', filters])
print()
print("To debug this, run 'tox -e py35-cov' (or py34-cov) locally and "
"check htmlcov/index.html")
print("To debug this, run 'tox -e py36-pyqt59-cov' "
"(or py35-pyqt59-cov) locally and check htmlcov/index.html")
print("or check https://codecov.io/github/qutebrowser/qutebrowser")
print()

View File

@ -118,11 +118,6 @@ pip --version
tox --version
case $TESTENV in
py34-cov)
pip_install -r misc/requirements/requirements-codecov.txt
apt_install xvfb $pyqt_pkgs libpython3.4-dev gdb apport libqt5webkit5-dbg python3-pyqt5-dbg python3-pyqt5.qtquick-dbg python3-pyqt5.qtwebkit-dbg python3-dbg
check_pyqt
;;
py3*-pyqt*)
#apt_install xvfb geoclue gdb apport
;;

View File

@ -89,3 +89,12 @@ def test_abort_typeerror(question, qtbot, mocker, caplog):
with caplog.at_level(logging.ERROR, 'misc'):
question.abort()
assert caplog.records[0].message == 'Error while aborting question'
def test_abort_twice(question, qtbot):
"""Abort a question twice."""
with qtbot.wait_signal(question.aborted):
question.abort()
assert question.is_aborted
with qtbot.assert_not_emitted(question.aborted):
question.abort()

63
tox.ini
View File

@ -4,7 +4,7 @@
# and then run "tox" from this directory.
[tox]
envlist = py36-cov,misc,vulture,flake8,pylint,pyroma,check-manifest,eslint
envlist = py36-pyqt59-cov,misc,vulture,flake8,pylint,pyroma,check-manifest,eslint
distshare = {toxworkdir}
skipsdist = true
@ -21,39 +21,6 @@ commands =
{envpython} scripts/link_pyqt.py --tox {envdir}
{envpython} -bb -m pytest {posargs:tests}
# test envs with coverage
[testenv:py36-cov]
basepython = python3.6
setenv = {[testenv]setenv}
passenv = {[testenv]passenv}
deps = {[testenv]deps}
commands =
{envpython} scripts/link_pyqt.py --tox {envdir}
{envpython} -bb -m pytest --cov --cov-report xml --cov-report=html --cov-report= {posargs:tests}
{envpython} scripts/dev/check_coverage.py {posargs}
[testenv:py35-cov]
basepython = python3.5
setenv = {[testenv]setenv}
passenv = {[testenv]passenv}
deps = {[testenv]deps}
commands =
{envpython} scripts/link_pyqt.py --tox {envdir}
{envpython} -bb -m pytest --cov --cov-report xml --cov-report=html --cov-report= {posargs:tests}
{envpython} scripts/dev/check_coverage.py {posargs}
[testenv:py34-cov]
basepython = python3.4
setenv = {[testenv]setenv}
passenv = {[testenv]passenv}
deps = {[testenv]deps}
commands =
{envpython} scripts/link_pyqt.py --tox {envdir}
{envpython} -bb -m pytest --cov --cov-report xml --cov-report=html --cov-report= {posargs:tests}
{envpython} scripts/dev/check_coverage.py {posargs}
# test envs with PyQt5 from PyPI
[testenv:py35-pyqt56]
@ -133,6 +100,34 @@ deps =
PyQt5==5.9
commands = {envpython} -bb -m pytest {posargs:tests}
# test envs with coverage
[testenv:py35-pyqt59-cov]
basepython = python3.6
setenv =
{[testenv]setenv}
QUTE_BDD_WEBENGINE=true
passenv = {[testenv]passenv}
deps =
{[testenv]deps}
PyQt5==5.9
commands =
{envpython} -bb -m pytest --cov --cov-report xml --cov-report=html --cov-report= {posargs:tests}
{envpython} scripts/dev/check_coverage.py {posargs}
[testenv:py36-pyqt59-cov]
basepython = python3.5
setenv =
{[testenv]setenv}
QUTE_BDD_WEBENGINE=true
passenv = {[testenv]passenv}
deps =
{[testenv]deps}
PyQt5==5.9
commands =
{envpython} -bb -m pytest --cov --cov-report xml --cov-report=html --cov-report= {posargs:tests}
{envpython} scripts/dev/check_coverage.py {posargs}
# other envs
[testenv:mkvenv]