0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 11:41:49 +02:00

fix: test_bec_monitor.py QApplication instance removed

This commit is contained in:
wyzula-jan
2023-10-29 12:04:21 +01:00
committed by wyzula_j
parent 60e864b259
commit 77e1d0925d

View File

@ -33,20 +33,20 @@ def setup_monitor(qtbot, config): # TODO fixture or helper function?
return widget return widget
@pytest.fixture(scope="module") # TODO is this needed? # @pytest.fixture(scope="module") # TODO is this needed?
def app(): # def app():
app = QApplication([]) # app = QApplication([])
yield app # yield app
#
#
@pytest.fixture # @pytest.fixture
def qtbot(app, qtbot): # TODO is this needed? # def qtbot(app, qtbot): # TODO is this needed?
"""A qtbot fixture to ensure that widgets are closed after being used.""" # """A qtbot fixture to ensure that widgets are closed after being used."""
qtbot.old_widgets = set(app.topLevelWidgets()) # qtbot.old_widgets = set(app.topLevelWidgets())
yield qtbot # yield qtbot
new_widgets = set(app.topLevelWidgets()) - qtbot.old_widgets # new_widgets = set(app.topLevelWidgets()) - qtbot.old_widgets
for widget in new_widgets: # for widget in new_widgets:
widget.close() # widget.close()
@pytest.mark.parametrize( @pytest.mark.parametrize(