Skip to content

Commit

Permalink
Testing: Check we re-run last cell after giving focus to another file
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 committed Jan 18, 2025
1 parent 11b42a8 commit 2dec328
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion spyder/app/tests/test_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1627,7 +1627,32 @@ def test_run_code(main_window, qtbot, tmpdir):
timeout=EVAL_TIMEOUT)
assert shell.get_value('li') == [1, 2, 3]

# try running cell without file name
# Clean namespace
with qtbot.waitSignal(shell.executed):
shell.execute('%reset -f')

# Wait until there are no objects in the variable explorer
qtbot.waitUntil(lambda: nsb.editor.source_model.rowCount() == 0,
timeout=EVAL_TIMEOUT)

# Open a new file
editor.load(osp.join(LOCATION, 'script_pylint.py'))
qtbot.wait(500)

# Re-run last cell (from the previous file).
# This is a regression for spyder-ide/spyder#23076
with qtbot.waitSignal(shell.executed):
re_run_action.trigger()

# We should get the same result as before
qtbot.waitUntil(lambda: nsb.editor.source_model.rowCount() == 1,
timeout=EVAL_TIMEOUT)
assert shell.get_value('li') == [1, 2, 3]

# Close new file
editor.close_file()

# Try running cell without file name
shell.clear()

# Clean namespace
Expand Down

0 comments on commit 2dec328

Please sign in to comment.