Skip to content

Commit

Permalink
Testing: Add timeout time to all ipdb kernel tests and mark them as f…
Browse files Browse the repository at this point in the history
…laky
  • Loading branch information
ccordoba12 committed Dec 27, 2018
1 parent c3ed33d commit 8ffbfad
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions requirements/tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ qtconsole
pytest
pytest-cov
pytest-qt
pytest-timeout
mock
flaky
25 changes: 25 additions & 0 deletions spyder_kernels/ipdb/tests/test_ipdb_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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'))
Expand Down Expand Up @@ -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':
Expand All @@ -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':
Expand Down Expand Up @@ -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)
Expand All @@ -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':
Expand Down

0 comments on commit 8ffbfad

Please sign in to comment.