Add backend to version output

This commit is contained in:
Florian Bruhin 2017-02-05 17:16:47 +01:00
parent b1a95a3930
commit a5c68babc1
2 changed files with 11 additions and 5 deletions

View File

@ -39,6 +39,7 @@ except ImportError: # pragma: no cover
import qutebrowser import qutebrowser
from qutebrowser.utils import log, utils, standarddir from qutebrowser.utils import log, utils, standarddir
from qutebrowser.misc import objects
from qutebrowser.browser import pdfjs from qutebrowser.browser import pdfjs
@ -229,6 +230,7 @@ def version():
gitver = _git_str() gitver = _git_str()
if gitver is not None: if gitver is not None:
lines.append("Git commit: {}".format(gitver)) lines.append("Git commit: {}".format(gitver))
lines.append("Backend: {}".format(objects.backend.name))
if qVersion() != QT_VERSION_STR: if qVersion() != QT_VERSION_STR:
qt_version = 'Qt: {} (compiled {})'.format(qVersion(), QT_VERSION_STR) qt_version = 'Qt: {} (compiled {})'.format(qVersion(), QT_VERSION_STR)

View File

@ -33,7 +33,7 @@ import textwrap
import pytest import pytest
import qutebrowser import qutebrowser
from qutebrowser.utils import version from qutebrowser.utils import version, usertypes
from qutebrowser.browser import pdfjs 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'}, '_path_info': lambda: {'PATH DESC': 'PATH NAME'},
'QApplication': (stubs.FakeQApplication(style='STYLE') if style else 'QApplication': (stubs.FakeQApplication(style='STYLE') if style else
stubs.FakeQApplication(instance=None)), stubs.FakeQApplication(instance=None)),
'objects.backend': (usertypes.Backend.QtWebKit if with_webkit
else usertypes.Backend.QtWebEngine),
} }
for attr, val in patches.items(): 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) monkeypatch.delattr(sys, 'frozen', raising=False)
template = textwrap.dedent(""" template = textwrap.dedent("""
qutebrowser vVERSION qutebrowser vVERSION{git_commit}
{git_commit} Backend: {backend}
PYTHON IMPLEMENTATION: PYTHON VERSION PYTHON IMPLEMENTATION: PYTHON VERSION
Qt: {qt} Qt: {qt}
PyQt: PYQT VERSION PyQt: PYQT VERSION
@ -705,13 +708,14 @@ def test_version_output(git_commit, frozen, style, equal_qt, with_webkit,
""".lstrip('\n')) """.lstrip('\n'))
substitutions = { 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 '', 'style': '\nStyle: STYLE' if style else '',
'qt': ('QT VERSION' if equal_qt else 'qt': ('QT VERSION' if equal_qt else
'QT RUNTIME VERSION (compiled QT VERSION)'), 'QT RUNTIME VERSION (compiled QT VERSION)'),
'frozen': str(frozen), 'frozen': str(frozen),
'import_path': import_path, '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) expected = template.rstrip('\n').format(**substitutions)