diff --git a/spyder_terminal/tests/test_terminal.py b/spyder_terminal/tests/test_terminal.py index 0beba3fe..23b853a0 100644 --- a/spyder_terminal/tests/test_terminal.py +++ b/spyder_terminal/tests/test_terminal.py @@ -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( @@ -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() @@ -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( @@ -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")