Skip to content

Commit

Permalink
Merge pull request #21186 from juliangilbey/tests-rerunnable
Browse files Browse the repository at this point in the history
PR: Do not overwrite test script to allow tests to be rerun
  • Loading branch information
ccordoba12 committed Jul 25, 2023
2 parents 2b85137 + 8776f4f commit d69632e
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions spyder/app/tests/test_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5417,8 +5417,8 @@ def test_PYTHONPATH_in_consoles(main_window, qtbot, tmp_path,
assert str(new_dir) in shell.get_value("sys_path")


@flaky(max_runs=3)
def test_clickable_ipython_tracebacks(main_window, qtbot, tmpdir):
@flaky(max_runs=10)
def test_clickable_ipython_tracebacks(main_window, qtbot, tmp_path):
"""
Test that file names in IPython console tracebacks are clickable.
Expand All @@ -5429,8 +5429,11 @@ def test_clickable_ipython_tracebacks(main_window, qtbot, tmpdir):
qtbot.waitUntil(lambda: shell._prompt_html is not None,
timeout=SHELL_TIMEOUT)

# Open test file
test_file = osp.join(LOCATION, 'script.py')
# Copy test file to a temporary location to avoid modifying it.
# See spyder-ide/spyder#21186 for the details
test_file_orig = osp.join(LOCATION, 'script.py')
test_file = str(tmp_path / 'script.py')
shutil.copyfile(test_file_orig, test_file)
main_window.editor.load(test_file)
code_editor = main_window.editor.get_focus_widget()

Expand Down Expand Up @@ -5473,11 +5476,6 @@ def test_clickable_ipython_tracebacks(main_window, qtbot, tmpdir):
cursor = code_editor.textCursor()
assert cursor.blockNumber() == code_editor.blockCount() - 1

# Remove error and save file
code_editor.delete_line()
code_editor.sig_save_requested.emit()
qtbot.wait(500)


if __name__ == "__main__":
pytest.main()

0 comments on commit d69632e

Please sign in to comment.