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: matrix:
include: include:
- os: linux
env: TESTENV=py34-cov
- os: linux - os: linux
env: DOCKER=debian-jessie env: DOCKER=debian-jessie
services: docker services: docker
@ -30,7 +28,7 @@ matrix:
env: TESTENV=py35-pyqt59 env: TESTENV=py35-pyqt59
- os: linux - os: linux
python: 3.6 python: 3.6
env: TESTENV=py36-pyqt59 env: TESTENV=py36-pyqt59-cov
- os: osx - os: osx
env: TESTENV=py36 OSX=elcapitan env: TESTENV=py36 OSX=elcapitan
osx_image: xcode7.3 osx_image: xcode7.3

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -118,11 +118,6 @@ pip --version
tox --version tox --version
case $TESTENV in 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*) py3*-pyqt*)
#apt_install xvfb geoclue gdb apport #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'): with caplog.at_level(logging.ERROR, 'misc'):
question.abort() question.abort()
assert caplog.records[0].message == 'Error while aborting question' 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. # and then run "tox" from this directory.
[tox] [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} distshare = {toxworkdir}
skipsdist = true skipsdist = true
@ -21,39 +21,6 @@ commands =
{envpython} scripts/link_pyqt.py --tox {envdir} {envpython} scripts/link_pyqt.py --tox {envdir}
{envpython} -bb -m pytest {posargs:tests} {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 # test envs with PyQt5 from PyPI
[testenv:py35-pyqt56] [testenv:py35-pyqt56]
@ -133,6 +100,34 @@ deps =
PyQt5==5.9 PyQt5==5.9
commands = {envpython} -bb -m pytest {posargs:tests} 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 # other envs
[testenv:mkvenv] [testenv:mkvenv]