Skip to content

Commit

Permalink
Fix right_click external plotter flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-el committed Jan 20, 2025
1 parent 1528d2e commit 44b68e0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/ert/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ def right_clicked(self) -> None:
pw.show()
self._external_plot_windows.append(pw)

def get_external_plot_windows(self) -> list[PlotWindow]:
return self._external_plot_windows

def select_central_widget(self) -> None:
actor = self.sender()
if actor:
Expand Down
11 changes: 5 additions & 6 deletions tests/ert/ui_tests/gui/test_main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
import numpy as np
import pytest
from qtpy.QtCore import Qt, QTimer
from qtpy.QtGui import QWindow
from qtpy.QtWidgets import (
QAction,
QApplication,
QCheckBox,
QComboBox,
QDoubleSpinBox,
Expand Down Expand Up @@ -650,11 +648,12 @@ def test_right_click_plot_button_opens_external_plotter(qtbot, storage, monkeypa
button_plot_tool = gui.findChild(SidebarToolButton, "button_Create_plot")
assert button_plot_tool

def top_level_plotter_windows() -> list[QWindow]:
def top_level_plotter_windows() -> list[PlotWindow]:
plot_windows = gui.get_external_plot_windows()
top_level_plot_windows = []
top_level_windows = QApplication.topLevelWindows()
for win in top_level_windows:
if "Plotting" in win.title() and win.isVisible():

for win in plot_windows:
if "Plotting" in win.windowTitle() and win.isVisible():
top_level_plot_windows.append(win)
return top_level_plot_windows

Expand Down

0 comments on commit 44b68e0

Please sign in to comment.