fix: process all deletion events before applying a new theme.

Note: this can be dropped once qthemes is updated.
This commit is contained in:
2025-09-15 13:52:43 +02:00
committed by wyzula_j
parent d69220c6dd
commit a3dc5091e3
2 changed files with 15 additions and 0 deletions
+7
View File
@@ -7,6 +7,7 @@ import pytest
from bec_lib import messages
from bec_qthemes import apply_theme
from pytestqt.exceptions import TimeoutError as QtBotTimeoutError
from qtpy.QtCore import QEvent, QEventLoop
from qtpy.QtWidgets import QApplication
from bec_widgets.cli.rpc.rpc_register import RPCRegister
@@ -23,9 +24,15 @@ def pytest_runtest_makereport(item, call):
item.stash["failed"] = rep.failed
def process_all_deferred_deletes(qapp):
qapp.sendPostedEvents(None, QEvent.DeferredDelete)
qapp.processEvents(QEventLoop.AllEvents)
@pytest.fixture(autouse=True)
def qapplication(qtbot, request, testable_qtimer_class): # pylint: disable=unused-argument
qapp = QApplication.instance()
process_all_deferred_deletes(qapp)
apply_theme("light")
qapp.processEvents()