From a5c68babc1daa1c34e28e9211b6ffbe610d7da47 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 5 Feb 2017 17:16:47 +0100 Subject: [PATCH] Add backend to version output --- qutebrowser/utils/version.py | 2 ++ tests/unit/utils/test_version.py | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/qutebrowser/utils/version.py b/qutebrowser/utils/version.py index c32cbb588..ca287f2af 100644 --- a/qutebrowser/utils/version.py +++ b/qutebrowser/utils/version.py @@ -39,6 +39,7 @@ except ImportError: # pragma: no cover import qutebrowser from qutebrowser.utils import log, utils, standarddir +from qutebrowser.misc import objects from qutebrowser.browser import pdfjs @@ -229,6 +230,7 @@ def version(): gitver = _git_str() if gitver is not None: lines.append("Git commit: {}".format(gitver)) + lines.append("Backend: {}".format(objects.backend.name)) if qVersion() != QT_VERSION_STR: qt_version = 'Qt: {} (compiled {})'.format(qVersion(), QT_VERSION_STR) diff --git a/tests/unit/utils/test_version.py b/tests/unit/utils/test_version.py index 39ae7cea1..2e1ea1b80 100644 --- a/tests/unit/utils/test_version.py +++ b/tests/unit/utils/test_version.py @@ -33,7 +33,7 @@ import textwrap import pytest import qutebrowser -from qutebrowser.utils import version +from qutebrowser.utils import version, usertypes from qutebrowser.browser import pdfjs @@ -671,6 +671,8 @@ def test_version_output(git_commit, frozen, style, equal_qt, with_webkit, '_path_info': lambda: {'PATH DESC': 'PATH NAME'}, 'QApplication': (stubs.FakeQApplication(style='STYLE') if style else stubs.FakeQApplication(instance=None)), + 'objects.backend': (usertypes.Backend.QtWebKit if with_webkit + else usertypes.Backend.QtWebEngine), } for attr, val in patches.items(): @@ -682,8 +684,9 @@ def test_version_output(git_commit, frozen, style, equal_qt, with_webkit, monkeypatch.delattr(sys, 'frozen', raising=False) template = textwrap.dedent(""" - qutebrowser vVERSION - {git_commit} + qutebrowser vVERSION{git_commit} + Backend: {backend} + PYTHON IMPLEMENTATION: PYTHON VERSION Qt: {qt} PyQt: PYQT VERSION @@ -705,13 +708,14 @@ def test_version_output(git_commit, frozen, style, equal_qt, with_webkit, """.lstrip('\n')) substitutions = { - 'git_commit': 'Git commit: GIT COMMIT\n' if git_commit else '', + 'git_commit': '\nGit commit: GIT COMMIT' if git_commit else '', 'style': '\nStyle: STYLE' if style else '', 'qt': ('QT VERSION' if equal_qt else 'QT RUNTIME VERSION (compiled QT VERSION)'), 'frozen': str(frozen), 'import_path': import_path, - 'webkit': 'WEBKIT VERSION' if with_webkit else 'no' + 'webkit': 'WEBKIT VERSION' if with_webkit else 'no', + 'backend': 'QtWebKit' if with_webkit else 'QtWebEngine', } expected = template.rstrip('\n').format(**substitutions)