From 63f9c54224b441d81ba82a173568d6b6ca8f96cd Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Thu, 27 Dec 2018 11:44:06 -0500 Subject: [PATCH] Testing: Add timeout time to all ipdb kernel tests --- requirements/tests.txt | 1 + spyder_kernels/ipdb/tests/test_ipdb_kernel.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) 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..d52794b4e 100644 --- a/spyder_kernels/ipdb/tests/test_ipdb_kernel.py +++ b/spyder_kernels/ipdb/tests/test_ipdb_kernel.py @@ -76,6 +76,7 @@ def test_available_magics(ipdb_kernel): assert magic in kernel.cell_magics +@pytest.mark.timeout(10) def test_shell_magic(ipdb_kernel): """Test %shell magic.""" kernel = ipdb_kernel @@ -92,6 +93,7 @@ def test_shell_magic(ipdb_kernel): @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 +111,7 @@ def test_break_magic(ipdb_kernel): assert script_path in log_text +@pytest.mark.timeout(10) def test_down_magic(ipdb_kernel): """Test %down magic.""" kernel = ipdb_kernel @@ -122,6 +125,7 @@ def test_down_magic(ipdb_kernel): assert 'Newest frame' in log_text +@pytest.mark.timeout(10) def test_help(ipdb_kernel): """Check availability of help information.""" kernel = ipdb_kernel @@ -140,6 +144,7 @@ def test_help(ipdb_kernel): assert resp == None +@pytest.mark.timeout(10) def test_complete(ipdb_kernel): """Check completion.""" kernel = ipdb_kernel @@ -189,6 +194,7 @@ def test_complete(ipdb_kernel): assert kwargs != [] +@pytest.mark.timeout(10) def test_inspect(ipdb_kernel): """Check inspect.""" kernel = ipdb_kernel @@ -199,6 +205,7 @@ def test_inspect(ipdb_kernel): kernel.do_inspect('%lsmagic ', len('%lsmagic') + 1) +@pytest.mark.timeout(10) def test_path_complete(ipdb_kernel): kernel = ipdb_kernel comp = kernel.do_complete('~/.ipytho', len('~/.ipytho')) @@ -228,6 +235,7 @@ def test_path_complete(ipdb_kernel): path) +@pytest.mark.timeout(10) def test_ls_path_complete(ipdb_kernel): kernel = ipdb_kernel if os.name != 'nt': @@ -240,12 +248,14 @@ def test_ls_path_complete(ipdb_kernel): @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 +@pytest.mark.timeout(10) def test_history(ipdb_kernel): kernel = ipdb_kernel if os.name != 'nt': @@ -273,6 +283,7 @@ def test_history(ipdb_kernel): assert '%cd ~' +@pytest.mark.timeout(10) def test_sticky_magics(ipdb_kernel): kernel = ipdb_kernel kernel.do_execute('%%%html\nhello', None) @@ -288,6 +299,7 @@ def test_sticky_magics(ipdb_kernel): @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':