diff --git a/requirements/tests.txt b/requirements/tests.txt index e1ce60876..026ec6d10 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -6,5 +6,6 @@ qtconsole pytest pytest-cov pytest-qt +pytest-timeout mock flaky diff --git a/spyder_kernels/ipdb/tests/test_ipdb_kernel.py b/spyder_kernels/ipdb/tests/test_ipdb_kernel.py index 2f95a65b4..fce507542 100644 --- a/spyder_kernels/ipdb/tests/test_ipdb_kernel.py +++ b/spyder_kernels/ipdb/tests/test_ipdb_kernel.py @@ -19,6 +19,7 @@ import sys # Test library imports +from flaky import flaky from metakernel.tests.utils import get_kernel, get_log_text import pytest @@ -76,6 +77,8 @@ def test_available_magics(ipdb_kernel): assert magic in kernel.cell_magics +@flaky +@pytest.mark.timeout(10) def test_shell_magic(ipdb_kernel): """Test %shell magic.""" kernel = ipdb_kernel @@ -90,8 +93,10 @@ def test_shell_magic(ipdb_kernel): os.remove('TEST.txt') +@flaky @pytest.mark.skipif(os.name == 'nt', reason="It's failing on Windows") +@pytest.mark.timeout(10) def test_break_magic(ipdb_kernel): """Test %break magic.""" kernel = ipdb_kernel @@ -109,6 +114,8 @@ def test_break_magic(ipdb_kernel): assert script_path in log_text +@flaky +@pytest.mark.timeout(10) def test_down_magic(ipdb_kernel): """Test %down magic.""" kernel = ipdb_kernel @@ -122,6 +129,8 @@ def test_down_magic(ipdb_kernel): assert 'Newest frame' in log_text +@flaky +@pytest.mark.timeout(10) def test_help(ipdb_kernel): """Check availability of help information.""" kernel = ipdb_kernel @@ -140,6 +149,8 @@ def test_help(ipdb_kernel): assert resp == None +@flaky +@pytest.mark.timeout(10) def test_complete(ipdb_kernel): """Check completion.""" kernel = ipdb_kernel @@ -189,6 +200,8 @@ def test_complete(ipdb_kernel): assert kwargs != [] +@flaky +@pytest.mark.timeout(10) def test_inspect(ipdb_kernel): """Check inspect.""" kernel = ipdb_kernel @@ -199,6 +212,8 @@ def test_inspect(ipdb_kernel): kernel.do_inspect('%lsmagic ', len('%lsmagic') + 1) +@flaky +@pytest.mark.timeout(10) def test_path_complete(ipdb_kernel): kernel = ipdb_kernel comp = kernel.do_complete('~/.ipytho', len('~/.ipytho')) @@ -228,6 +243,8 @@ def test_path_complete(ipdb_kernel): path) +@flaky +@pytest.mark.timeout(10) def test_ls_path_complete(ipdb_kernel): kernel = ipdb_kernel if os.name != 'nt': @@ -238,14 +255,18 @@ def test_ls_path_complete(ipdb_kernel): assert comp['matches'] == ['"ipython\\"'], comp +@flaky @pytest.mark.skipif(not sys.platform.startswith('linux'), reason="Only for linux") +@pytest.mark.timeout(10) def test_not_get_completions_path(ipdb_kernel): kernel = ipdb_kernel comp = kernel.do_complete('/tm', len('/tm')) assert len(comp['matches']) == 1 +@flaky +@pytest.mark.timeout(10) def test_history(ipdb_kernel): kernel = ipdb_kernel if os.name != 'nt': @@ -273,6 +294,8 @@ def test_history(ipdb_kernel): assert '%cd ~' +@flaky +@pytest.mark.timeout(10) def test_sticky_magics(ipdb_kernel): kernel = ipdb_kernel kernel.do_execute('%%%html\nhello', None) @@ -286,8 +309,10 @@ def test_sticky_magics(ipdb_kernel): assert 'html removed from session magics' in text +@flaky @pytest.mark.skipif(os.environ.get('CI', None) is None, reason="It's not meant to be run outside of CIs") +@pytest.mark.timeout(10) def test_shell_partial_quote(ipdb_kernel): kernel = ipdb_kernel if os.name != 'nt':