Skip to content

Commit 1cc482a

Browse files
committed
Tour feature: add unattended unit test
1 parent 20dec97 commit 1cc482a

File tree

2 files changed

+30
-17
lines changed

2 files changed

+30
-17
lines changed

cdl/core/gui/tour.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454

5555
import numpy as np
5656
from guidata.configtools import get_icon, get_image_file_path
57-
from guidata.qthelpers import is_dark_mode
57+
from guidata.env import execenv
58+
from guidata.qthelpers import exec_dialog, is_dark_mode
5859
from qtpy import QtCore as QC
5960
from qtpy import QtGui as QG
6061
from qtpy import QtWidgets as QW
@@ -400,7 +401,9 @@ def show(self) -> StepResult:
400401
self.setup_callback(self.tour.win)
401402
self.update_cover(self.tour.cover)
402403
dialog = StepDialog(self.tour.win, self)
403-
dialog.exec()
404+
exec_dialog(dialog)
405+
if execenv.unattended and self.step_type != "conclusion":
406+
dialog.result = StepResult.NEXT
404407
if self.teardown_callback is not None:
405408
self.teardown_callback(self.tour.win)
406409
return dialog.result
@@ -869,18 +872,3 @@ def start(win: CDLMainWindow) -> None:
869872
"""
870873
tour = Tour(win)
871874
tour.start()
872-
873-
874-
def test_tour() -> None:
875-
"""
876-
Test the tour of DataLab features.
877-
"""
878-
# pylint: disable=import-outside-toplevel
879-
from cdl.tests import cdltest_app_context
880-
881-
with cdltest_app_context() as win:
882-
start(win)
883-
884-
885-
if __name__ == "__main__":
886-
test_tour()

cdl/tests/features/tour_unit.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Licensed under the terms of the BSD 3-Clause
4+
# (see cdl/LICENSE for details)
5+
6+
"""
7+
Tour test
8+
"""
9+
10+
# guitest: show
11+
12+
from cdl.core.gui.tour import start
13+
from cdl.tests import cdltest_app_context
14+
15+
16+
def test_tour() -> None:
17+
"""
18+
Test the tour of DataLab features.
19+
"""
20+
with cdltest_app_context() as win:
21+
start(win)
22+
23+
24+
if __name__ == "__main__":
25+
test_tour()

0 commit comments

Comments
 (0)