Skip to content

Commit

Permalink
split tests in 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Zybulon committed Sep 21, 2024
1 parent fc8522b commit da467d3
Showing 1 changed file with 34 additions and 5 deletions.
39 changes: 34 additions & 5 deletions spyder_terminal/tests/test_terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@ def teardown():
return terminal


@flaky(max_runs=5)
@flaky(max_runs=3)
@pytest.mark.skipif((os.environ.get('CI') and
sys.platform.startswith('linux')),
reason="Doesn't work on Linux CIs")
def test_terminal_paste(setup_terminal, qtbot_module):
def test_terminal_paste_1(setup_terminal, qtbot_module):
"""Test the paste action in the terminal."""
terminal = setup_terminal
qtbot_module.waitUntil(
Expand All @@ -196,9 +196,31 @@ def test_terminal_paste(setup_terminal, qtbot_module):
QApplication.clipboard().clear()
QApplication.clipboard().setText(separator.join(expected))
term.view.paste()
qtbot_module.wait(1000)
qtbot_module.waitUntil(lambda: check_paste(term, expected),
timeout=TERM_UP)


@flaky(max_runs=3)
@pytest.mark.skipif((os.environ.get('CI') and
sys.platform.startswith('linux')),
reason="Doesn't work on Linux CIs")
def test_terminal_paste_2(setup_terminal, qtbot_module):
"""Test the paste action in the terminal."""
terminal = setup_terminal
qtbot_module.waitUntil(
lambda: terminal.get_widget().server_is_ready(), timeout=TERM_UP)
qtbot_module.wait(1000)

term = terminal.get_widget().get_current_term()
port = terminal.get_widget().port
status_code = requests.get('http://127.0.0.1:{}'.format(port)).status_code
assert status_code == 200

term.exec_cmd(f'{os.linesep}' * 2)

separator = os.linesep

expected = ['this', 'a', 'test']
QApplication.clipboard().setText(separator.join(expected))
term.view.paste()
Expand Down Expand Up @@ -395,7 +417,7 @@ def test_terminal_cwd(setup_terminal, qtbot_module):


@flaky(max_runs=3)
def test_conda_path(setup_terminal, qtbot_module):
def test_conda_path_1(setup_terminal, qtbot_module):
"""Test if conda is correctly added to the path of the terminal."""
terminal = setup_terminal
qtbot_module.waitUntil(
Expand All @@ -407,9 +429,16 @@ def test_conda_path(setup_terminal, qtbot_module):
term.exec_cmd("conda env list")
qtbot_module.wait(1000)
qtbot_module.waitUntil(lambda: check_output(term, "test"), timeout=TERM_UP)

@flaky(max_runs=3)
def test_conda_path_2(setup_terminal, qtbot_module):
"""Test if conda is correctly added to the path of the terminal."""
terminal = setup_terminal
qtbot_module.waitUntil(
lambda: terminal.get_widget().server_is_ready(), timeout=TERM_UP)
qtbot_module.wait(2000)

# Clear the terminal
term.exec_cmd("clear")
term = terminal.get_widget().get_current_term()

# Try to deactivate the current environment
term.exec_cmd("conda deactivate")
Expand Down

0 comments on commit da467d3

Please sign in to comment.