Skip to content

Commit 1380774

Browse files
committed
Maybe test_dedicated_consoles works for macOS now?
Add test for attempting to execute while shell is already executing.
1 parent bcf5fbe commit 1380774

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

spyder/app/tests/test_mainwindow.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,6 @@ def check_cwd():
812812
sys.platform.startswith("linux") and running_in_ci(),
813813
reason='Fails sometimes on Linux and CIs'
814814
)
815-
@pytest.mark.skipif(sys.platform == "darwin", reason="Fails sometimes on Mac")
816815
@pytest.mark.close_main_window
817816
def test_dedicated_consoles(main_window, qtbot):
818817
"""Test running code in dedicated consoles."""
@@ -822,7 +821,7 @@ def test_dedicated_consoles(main_window, qtbot):
822821
timeout=SHELL_TIMEOUT,
823822
)
824823

825-
# ---- Load test file ----
824+
# --- Load test file ---
826825
test_file = osp.join(LOCATION, 'script.py')
827826
main_window.editor.load(test_file)
828827
code_editor = main_window.editor.get_focus_widget()
@@ -915,7 +914,13 @@ def test_dedicated_consoles(main_window, qtbot):
915914
# --- Assert runfile text is present after reruns ---
916915
assert 'runfile' in control.toPlainText()
917916

918-
# ---- Closing test file and resetting config ----
917+
# --- Assert no re-execution when already executing
918+
shell.execute("import time; time.sleep(5)") # Execute something long
919+
qtbot.keyClick(code_editor, Qt.Key_F5) # Try to execute while busy
920+
qtbot.wait(6000) # First exectution should be done
921+
assert not shell.is_defined("zz") # Second execution did not occur
922+
923+
# --- Closing test file and resetting config ---
919924
main_window.editor.close_file()
920925
CONF.set('run', 'configurations', {})
921926
CONF.set('run', 'last_used_parameters_per_executor', {})

0 commit comments

Comments
 (0)