Update version tests for uptime

This commit is contained in:
Jay Kamat 2017-11-13 23:20:12 -05:00
parent ae48fa68a8
commit 4845180689
No known key found for this signature in database
GPG Key ID: 5D2E399600F4F7B5

View File

@ -31,6 +31,7 @@ import importlib
import logging import logging
import textwrap import textwrap
import pkg_resources import pkg_resources
import datetime
import attr import attr
import pytest import pytest
@ -870,6 +871,7 @@ def test_version_output(params, stubs, monkeypatch):
stubs.FakeQApplication(instance=None)), stubs.FakeQApplication(instance=None)),
'QLibraryInfo.location': (lambda _loc: 'QT PATH'), 'QLibraryInfo.location': (lambda _loc: 'QT PATH'),
'sql.version': lambda: 'SQLITE VERSION', 'sql.version': lambda: 'SQLITE VERSION',
'_uptime': lambda: datetime.timedelta(hours=1, minutes=23, seconds=45),
} }
substitutions = { substitutions = {
@ -913,6 +915,8 @@ def test_version_output(params, stubs, monkeypatch):
else: else:
monkeypatch.delattr(sys, 'frozen', raising=False) monkeypatch.delattr(sys, 'frozen', raising=False)
substitutions['uptime'] = "1:23:45"
template = textwrap.dedent(""" template = textwrap.dedent("""
qutebrowser vVERSION{git_commit} qutebrowser vVERSION{git_commit}
Backend: {backend} Backend: {backend}
@ -934,6 +938,8 @@ def test_version_output(params, stubs, monkeypatch):
{osinfo} {osinfo}
Paths: Paths:
PATH DESC: PATH NAME PATH DESC: PATH NAME
Uptime: {uptime}
""".lstrip('\n')) """.lstrip('\n'))
expected = template.rstrip('\n').format(**substitutions) expected = template.rstrip('\n').format(**substitutions)