summaryrefslogtreecommitdiff
path: root/tests/unit/completion/test_models.py
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2020-07-29 17:42:22 +0200
committerFlorian Bruhin <me@the-compiler.org>2020-07-29 20:39:53 +0200
commit9bdcea42de5682e4d0e9d88a3a0ec8236efc9e5a (patch)
tree991c42c38085d045b4a72ab4b65a193424c881d6 /tests/unit/completion/test_models.py
parentf8e83dcaa16dadafd4c6824eda93c6c5df6c17cf (diff)
downloadqutebrowser-9bdcea42de5682e4d0e9d88a3a0ec8236efc9e5a.tar.gz
qutebrowser-9bdcea42de5682e4d0e9d88a3a0ec8236efc9e5a.zip
Fix QDateTime conversions
- Qt 5.7 doesn't have QDateTime::(from|to)SecsSinceEpoch, so we need to use the msecs variant instead. - We were passing a float which causes a TypeError (rather than being truncated to an int) with newer PyQt versions.
Diffstat (limited to 'tests/unit/completion/test_models.py')
-rw-r--r--tests/unit/completion/test_models.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/unit/completion/test_models.py b/tests/unit/completion/test_models.py
index dd0f910c0..f88a7657e 100644
--- a/tests/unit/completion/test_models.py
+++ b/tests/unit/completion/test_models.py
@@ -1211,7 +1211,8 @@ def tab_with_history(fake_web_tab, tabbed_browser_stubs, info, monkeypatch):
entry = mock.Mock(spec=QWebEngineHistoryItem)
entry.url.return_value = QUrl(url)
entry.title.return_value = title
- entry.lastVisited.return_value = QDateTime.fromSecsSinceEpoch(ts)
+ dt = QDateTime.fromMSecsSinceEpoch(int(ts * 1000))
+ entry.lastVisited.return_value = dt
history.append(entry)
tab.history._history = mock.Mock(spec=QWebEngineHistory)
tab.history._history.items.return_value = history