Skip to content

Commit

Permalink
Add outlineexplorer test for display_variables
Browse files Browse the repository at this point in the history
  • Loading branch information
remisalmon committed Nov 2, 2023
1 parent c360651 commit 1428d32
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions spyder/plugins/outlineexplorer/tests/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,42 @@ def test_go_to_last_item(create_outlineexplorer, qtbot):
Qt.LeftButton)
assert outlineexplorer.treewidget.currentItem().text(0) == 'method1'

@flaky(max_runs=10)
def test_display_variables(create_outlineexplorer, qtbot):
"""
Test that clicking on the 'Display variables and attributes' button located in the
toolbar of the outline explorer is working as expected by updating the tree widget.
Regression test for spyder-ide/spyder#21456.
"""
outlineexplorer, _ = create_outlineexplorer('text')

editor = outlineexplorer.treewidget.current_editor
editor_id = editor.get_id()

initial_tree = outlineexplorer.treewidget.editor_tree_cache[editor_id]

# Click on the 'Display variables and attributes' button of the outline explorer's
# toolbar :
# qtbot.mouseClick(
# TODO,
# Qt.LeftButton)
outlineexplorer.treewidget.toggle_variables(not outlineexplorer.treewidget.display_variables)

first_toggle_tree = outlineexplorer.treewidget.editor_tree_cache[editor_id]

assert first_toggle_tree != initial_tree

# Click on the 'Display variables and attributes' button of the outline explorer's
# toolbar :
# qtbot.mouseClick(
# TODO,
# Qt.LeftButton)
outlineexplorer.treewidget.toggle_variables(not outlineexplorer.treewidget.display_variables)

second_toggle_tree = outlineexplorer.treewidget.editor_tree_cache[editor_id]

assert (second_toggle_tree != first_toggle_tree) and (second_toggle_tree == initial_tree)

if __name__ == "__main__":
import os
Expand Down

0 comments on commit 1428d32

Please sign in to comment.