From 05683063b2c99854bfb3c823520edac8f8c20921 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sat, 27 May 2017 13:14:08 -0700 Subject: [PATCH] Add basic testing of wxagg backend. wxPython provides Trusty wheels, so use them. --- .travis.yml | 20 +++++++++++++++---- .../tests/test_backends_interactive.py | 17 ++++++++-------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 211b76f80549..ca223edb2c9e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -123,10 +123,22 @@ install: pyparsing!=2.1.6 \ python-dateutil \ sphinx - # GUI toolkits are pip-installable only for some versions of Python so don't - # fail if we can't install them. - pip install pyqt5 || true - python -c 'import PyQt5.QtCore' || true + # GUI toolkits are pip-installable only for some versions of Python so + # don't fail if we can't install them. Make it easier to check whether the + # install was successful by trying to import the toolkit (sometimes, the + # install appears to be successful but shared libraries cannot be loaded at + # runtime, so an actual import is a better check). + pip install pyqt5 && + python -c 'import PyQt5.QtCore' && + echo 'PyQt5 is available' || + echo 'PyQt5 is not available' + pip install -U --pre \ + -f https://wxpython.org/Phoenix/release-extras/linux/gtk3/ubuntu-14.04 \ + wxPython && + python -c 'import wx' && + echo 'wxPython is available' || + echo 'wxPython is not available' + if [[ $BUILD_DOCS == true ]]; then pip install $PRE -r doc-requirements.txt fi diff --git a/lib/matplotlib/tests/test_backends_interactive.py b/lib/matplotlib/tests/test_backends_interactive.py index 1c23ddabc8fa..1b763ea0687e 100644 --- a/lib/matplotlib/tests/test_backends_interactive.py +++ b/lib/matplotlib/tests/test_backends_interactive.py @@ -20,16 +20,15 @@ def _get_available_backends(): - if sys.version_info < (3,): - return [] - else: - return [ - pytest.mark.skipif( - importlib.util.find_spec(module_name) is None, - reason="Could not import {!r}".format(module_name))(backend) - for module_name, backend in [ + return [ + pytest.mark.skipif(sys.version_info < (3,) + or importlib.util.find_spec(module_name) is None, + reason="Could not import {!r}".format(module_name))( + backend) + for module_name, backend in [ ("PyQt5", "qt5agg"), - ("tkinter", "tkagg")]] + ("tkinter", "tkagg"), + ("wx", "wxagg")]] _test_script = """\