Skip to content

Commit 7c9039f

Browse files
committed
Fix blocking test_colormap_manager in unattended mode
1 parent 1619aaa commit 7c9039f

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

plotpy/tests/features/test_colormap_manager.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from guidata.env import execenv
1818
from guidata.qthelpers import exec_dialog, qt_app_context
1919

20-
from plotpy.mathutils.colormap import ALL_COLORMAPS, delete_cmap, get_cmap
20+
from plotpy.mathutils.colormap import delete_cmap, get_cmap
2121
from plotpy.widgets.colormap.manager import ColorMapManager
2222
from plotpy.widgets.colormap.widget import EditableColormap
2323

@@ -50,8 +50,8 @@ def test_colormap_manager(test_cmap: EditableColormap) -> None:
5050
# set the colormap to last one
5151
with execenv.context(accept_dialogs=True):
5252
cmap_editor.remove_colormap()
53+
result = exec_dialog(cmap_editor)
5354

54-
result = exec_dialog(cmap_editor)
5555
execenv.print("Dialog result:", result)
5656
cmap = cmap_editor.get_colormap()
5757
execenv.print("Selected colormap:", None if cmap is None else cmap.name)

plotpy/tests/items/test_curves.py

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
from plotpy.builder import make
1414
from plotpy.tests import vistools as ptv
15-
from plotpy.tools import CurveStatsTool
1615

1716

1817
def test_plot():

plotpy/widgets/colormap/manager.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import qtpy.QtGui as QG
2929
import qtpy.QtWidgets as QW
3030
from guidata.configtools import get_icon
31+
from guidata.env import execenv
3132
from guidata.qthelpers import exec_dialog
3233

3334
from plotpy.config import _
@@ -352,7 +353,10 @@ def remove_colormap(self) -> None:
352353
QW.QMessageBox.Ok,
353354
)
354355
return
355-
if (
356+
if execenv.unattended: # For testing purposes only
357+
if not execenv.accept_dialogs:
358+
return
359+
elif (
356360
QW.QMessageBox.question(
357361
self,
358362
_("Remove"),

0 commit comments

Comments
 (0)