diff --git a/.travis.yml b/.travis.yml index 4429cc0d5..fd2e8d172 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/qutebrowser/browser/history.py b/qutebrowser/browser/history.py index 2d5c263bc..c6624e157 100644 --- a/qutebrowser/browser/history.py +++ b/qutebrowser/browser/history.py @@ -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) diff --git a/qutebrowser/browser/webkit/certificateerror.py b/qutebrowser/browser/webkit/certificateerror.py index d02ded76c..1d2df1562 100644 --- a/qutebrowser/browser/webkit/certificateerror.py +++ b/qutebrowser/browser/webkit/certificateerror.py @@ -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())) diff --git a/qutebrowser/mainwindow/statusbar/backforward.py b/qutebrowser/mainwindow/statusbar/backforward.py index fe044e621..3a566e105 100644 --- a/qutebrowser/mainwindow/statusbar/backforward.py +++ b/qutebrowser/mainwindow/statusbar/backforward.py @@ -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 diff --git a/qutebrowser/misc/miscwidgets.py b/qutebrowser/misc/miscwidgets.py index b4a17e638..94be76734 100644 --- a/qutebrowser/misc/miscwidgets.py +++ b/qutebrowser/misc/miscwidgets.py @@ -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): diff --git a/qutebrowser/utils/urlutils.py b/qutebrowser/utils/urlutils.py index 4cd0e94d0..71174b270 100644 --- a/qutebrowser/utils/urlutils.py +++ b/qutebrowser/utils/urlutils.py @@ -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()) diff --git a/scripts/dev/check_coverage.py b/scripts/dev/check_coverage.py index e22d3a155..14d3a9f49 100644 --- a/scripts/dev/check_coverage.py +++ b/scripts/dev/check_coverage.py @@ -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() diff --git a/scripts/dev/ci/travis_install.sh b/scripts/dev/ci/travis_install.sh index dd9d47640..62314b2b1 100644 --- a/scripts/dev/ci/travis_install.sh +++ b/scripts/dev/ci/travis_install.sh @@ -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 ;; diff --git a/tests/unit/utils/usertypes/test_question.py b/tests/unit/utils/usertypes/test_question.py index 031e304cc..b11c01b6a 100644 --- a/tests/unit/utils/usertypes/test_question.py +++ b/tests/unit/utils/usertypes/test_question.py @@ -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() diff --git a/tox.ini b/tox.ini index 04cf826d1..e916f4a83 100644 --- a/tox.ini +++ b/tox.ini @@ -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]