From 83b94a8be56c81aa593a89b20b456406185b27c1 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sat, 28 Nov 2015 20:41:42 +0100 Subject: [PATCH] Fix session tests. FakeMainWindow needs to be a QObject now as we use sip.isdeleted since 8cf6ace0e7331c75f1da2fe694faf756ba79421d and that raises a TypeError on non-QObject's. --- tests/unit/misc/test_sessions.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/unit/misc/test_sessions.py b/tests/unit/misc/test_sessions.py index 326c0cd48..45602be61 100644 --- a/tests/unit/misc/test_sessions.py +++ b/tests/unit/misc/test_sessions.py @@ -25,7 +25,7 @@ import logging import pytest import yaml -from PyQt5.QtCore import QUrl, QPoint, QByteArray +from PyQt5.QtCore import QUrl, QPoint, QByteArray, QObject from PyQt5.QtWebKitWidgets import QWebView from qutebrowser.misc import sessions @@ -277,14 +277,17 @@ class TestSaveTab: assert hist[1]['scroll-pos'] == {'x': pos_x, 'y': pos_y} -class FakeMainWindow: +class FakeMainWindow(QObject): """Helper class for the fake_main_window fixture. A fake MainWindow which provides a saveGeometry method. + + Needs to be a QObject so sip.isdeleted works. """ - def __init__(self, geometry, win_id): + def __init__(self, geometry, win_id, parent=None): + super().__init__(parent) self._geometry = QByteArray(geometry) self.win_id = win_id