From 6015feb9c56cae950f7cdfa82f6034d13068767f Mon Sep 17 00:00:00 2001 From: GuyTeichman <48219633+GuyTeichman@users.noreply.github.com> Date: Wed, 20 Dec 2023 15:18:43 +0200 Subject: [PATCH] added teardown step to main_window fixture --- tests/test_gui.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/test_gui.py b/tests/test_gui.py index b4852069..3757575f 100644 --- a/tests/test_gui.py +++ b/tests/test_gui.py @@ -98,7 +98,15 @@ def main_window(qtbot, monkeypatch, use_temp_settings_file): # sys.excepthook = window.excepthook builtins.input = window.input window._toggle_reporting(True) - return window + yield window + + app = QtWidgets.QApplication.instance() + if app is not None: + for w in app.topLevelWidgets(): + w.close() + n = len(app.topLevelWidgets()) + print(f"{n} widgets in the balance.") + @pytest.fixture