Report sqlite version with --version.

This commit is contained in:
Ryan Roden-Corrent 2017-02-20 08:33:38 -05:00
parent 4968590075
commit a050cb94f6
4 changed files with 17 additions and 1 deletions

View File

@ -41,6 +41,13 @@ def close():
QSqlDatabase.removeDatabase(QSqlDatabase.database().connectionName())
def version():
"""Return the sqlite version string."""
result = run_query("select sqlite_version()")
result.next()
return result.record().value(0)
def run_query(querystr, values=None):
"""Run the given SQL query string on the database.

View File

@ -45,7 +45,7 @@ except ImportError: # pragma: no cover
import qutebrowser
from qutebrowser.utils import log, utils, standarddir, usertypes, qtutils
from qutebrowser.misc import objects, earlyinit
from qutebrowser.misc import objects, earlyinit, sql
from qutebrowser.browser import pdfjs
@ -327,6 +327,10 @@ def version():
lines += ['pdf.js: {}'.format(_pdfjs_version())]
sql.init()
lines += ['sqlite: {}'.format(sql.version())]
sql.close()
lines += [
'SSL: {}'.format(QSslSocket.sslLibraryVersionString()),
'',

View File

@ -120,3 +120,6 @@ def test_delete_all(qtbot):
with qtbot.waitSignal(table.changed):
table.delete_all()
assert list(table) == []
def test_version():
assert isinstance(sql.version(), str)

View File

@ -834,6 +834,7 @@ def test_version_output(git_commit, frozen, style, with_webkit,
'QApplication': (stubs.FakeQApplication(style='STYLE') if style else
stubs.FakeQApplication(instance=None)),
'QLibraryInfo.location': (lambda _loc: 'QT PATH'),
'sql.version': lambda: 'SQLITE VERSION',
}
substitutions = {
@ -892,6 +893,7 @@ def test_version_output(git_commit, frozen, style, with_webkit,
MODULE VERSION 1
MODULE VERSION 2
pdf.js: PDFJS VERSION
sqlite: SQLITE VERSION
SSL: SSL VERSION
{style}
Platform: PLATFORM, ARCHITECTURE{linuxdist}