Skip to content

Commit

Permalink
Merge pull request #6286 from CAM-Gerlach/travis-window-manager
Browse files Browse the repository at this point in the history
PR: Install and run window manager in Travis to fix focus issues and unskip now-passing tests
  • Loading branch information
ccordoba12 authored Jan 24, 2018
2 parents a0528c7 + ecc3488 commit a7394fb
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 23 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,16 @@ matrix:
before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
# Avoid annoying focus problems when running tests
# See discussion in e.g. https://github.com/spyder-ide/spyder/pull/6132
- sudo apt-get -qq update
- sudo apt-get install -y matchbox-window-manager

install:
- ./continuous_integration/travis/install.sh;
- ./continuous_integration/travis/install-qt.sh;
- DISPLAY=:99 matchbox-window-manager &
- sleep 5

script:
- ./continuous_integration/travis/runtests.sh || ./continuous_integration/travis/runtests.sh || ./continuous_integration/travis/runtests.sh;
Expand Down
9 changes: 5 additions & 4 deletions spyder/app/tests/test_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,14 @@ def close_window():
#==============================================================================
# IMPORTANT NOTE: Please leave this test to be the first one here to
# avoid possible timeouts in Appveyor
@pytest.mark.slow
@pytest.mark.use_introspection
@flaky(max_runs=3)
@pytest.mark.skipif(os.environ.get('CI', None) is not None or os.name == 'nt' or PY2,
reason="It times out in our CIs, and apparently Windows.")
@pytest.mark.timeout(timeout=60, method='thread')
@pytest.mark.skipif(os.name == 'nt',
reason="It times out on Windows locally and on AppVeyor.")
@pytest.mark.timeout(timeout=45, method='thread')
def test_calltip(main_window, qtbot):
"""Hide the calltip in the editor when a matching ')' is found."""
"""Test that the calltip in editor is hidden when matching ')' is found."""
# Load test file
text = 'a = [1,2,3]\n(max'
main_window.editor.new(fname="test.py", text=text)
Expand Down
6 changes: 4 additions & 2 deletions spyder/plugins/tests/test_ipythonconsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,12 @@ def test_read_stderr(ipyconsole, qtbot):
assert content == client._read_stderr()


@pytest.mark.slow
@flaky(max_runs=10)
@pytest.mark.no_xvfb
@pytest.mark.skipif(os.environ.get('CI', None) is not None,
reason="It times out in our CIs")
@pytest.mark.skipif(os.environ.get('CI', None) is not None and os.name == 'nt',
reason="It times out on AppVeyor.")
@pytest.mark.timeout(timeout=20, method='thread')
def test_values_dbg(ipyconsole, qtbot):
"""
Test that getting, setting, copying and removing values is working while
Expand Down
10 changes: 6 additions & 4 deletions spyder/widgets/tests/test_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""

# Standard library imports
import os
from sys import platform
try:
from unittest.mock import Mock, MagicMock
Expand Down Expand Up @@ -471,7 +472,7 @@ def test_editor_splitter_init(editor_splitter_bot):


def test_tab_keypress_properly_caught_find_replace(editor_find_replace_bot):
"""Check that tab works in find/replace dialog. Regression test #3674.
"""Test that tab works in find/replace dialog. Regression test for #3674.
Mock test—more isolated but less flimsy."""
editor_stack, editor, finder, qtbot = editor_find_replace_bot
text = ' \nspam \nspam \nspam '
Expand All @@ -485,10 +486,11 @@ def test_tab_keypress_properly_caught_find_replace(editor_find_replace_bot):


@flaky(max_runs=3)
@pytest.mark.skipif(platform.startswith('linux'),
reason="This test fails on Linux, for unknown reasons.")
@pytest.mark.skipif(os.environ.get('CI', None) is None and
platform.startswith('linux'),
reason="Fails on some Linux platforms locally.")
def test_tab_moves_focus_from_search_to_replace(editor_find_replace_bot):
"""Check that tab works in find/replace dialog. Regression test #3674.
"""Test that tab works in find/replace dialog. Regression test for #3674.
"Real world" test—more comprehensive but potentially less robust."""
editor_stack, editor, finder, qtbot = editor_find_replace_bot
text = ' \nspam \nspam \nspam '
Expand Down
21 changes: 8 additions & 13 deletions spyder/widgets/variableexplorer/tests/test_dataframeeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def test_sort_dataframe_with_category_dtypes(qtbot): # cf. issue 5361


def test_dataframemodel_set_data_overflow(monkeypatch):
"""Unit test #6114: entry of an overflow int caught and handled properly"""
"""Test for #6114: Overflowing ints are caught and handled properly"""
MockQMessageBox = Mock()
attr_to_patch = ('spyder.widgets.variableexplorer' +
'.dataframeeditor.QMessageBox')
Expand All @@ -301,10 +301,11 @@ def test_dataframemodel_set_data_overflow(monkeypatch):


@flaky(max_runs=3)
@pytest.mark.skipif(platform.startswith('linux'),
reason="Fails on some Linux platforms locally and Travis.")
@pytest.mark.skipif(os.environ.get('CI', None) is None and
platform.startswith('linux'),
reason="Fails on some Linux platforms locally.")
def test_dataframeeditor_edit_overflow(qtbot, monkeypatch):
"""Test #6114: entry of an overflow int is caught and handled properly"""
"""Test #6114: Entry of an overflow int is caught and handled properly"""
MockQMessageBox = Mock()
attr_to_patch = ('spyder.widgets.variableexplorer' +
'.dataframeeditor.QMessageBox')
Expand Down Expand Up @@ -346,7 +347,7 @@ def test_dataframeeditor_edit_overflow(qtbot, monkeypatch):


def test_dataframemodel_set_data_complex(monkeypatch):
"""Unit test #6115: editing complex dtypes raises error in df editor"""
"""Test for #6115: Editing complex dtypes raises error in df editor"""
MockQMessageBox = Mock()
attr_to_patch = ('spyder.widgets.variableexplorer' +
'.dataframeeditor.QMessageBox')
Expand All @@ -366,9 +367,6 @@ def test_dataframemodel_set_data_complex(monkeypatch):


@flaky(max_runs=3)
@pytest.mark.skipif(os.environ.get('CI', None) is not None or
platform.startswith('linux'),
reason="Fails on Travis for no good reason.")
def test_dataframeeditor_edit_complex(qtbot, monkeypatch):
"""Test for #6115: editing complex dtypes raises error in df editor"""
MockQMessageBox = Mock()
Expand Down Expand Up @@ -408,7 +406,7 @@ def test_dataframeeditor_edit_complex(qtbot, monkeypatch):


def test_dataframemodel_set_data_bool(monkeypatch):
"""Unit test that bools are editible in df and false-y strs are detected"""
"""Test that bools are editible in df and false-y strs are detected"""
MockQMessageBox = Mock()
attr_to_patch = ('spyder.widgets.variableexplorer' +
'.dataframeeditor.QMessageBox')
Expand All @@ -429,11 +427,8 @@ def test_dataframemodel_set_data_bool(monkeypatch):


@flaky(max_runs=3)
@pytest.mark.skipif(os.environ.get('CI', None) is not None or
platform.startswith('linux'),
reason="Fails on Travis for no good reason.")
def test_dataframeeditor_edit_bool(qtbot, monkeypatch):
"""Unit test that bools are editible in df and false-y strs are detected"""
"""Test that bools are editible in df and false-y strs are detected"""
MockQMessageBox = Mock()
attr_to_patch = ('spyder.widgets.variableexplorer' +
'.dataframeeditor.QMessageBox')
Expand Down

0 comments on commit a7394fb

Please sign in to comment.