From a0586804b7b9967102d622256b6fe30a4922fc27 Mon Sep 17 00:00:00 2001 From: Eric Dill Date: Sun, 2 Aug 2015 11:00:26 -0400 Subject: [PATCH 1/7] MNT: Test python 2.6 on travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index de5ac94d..3171f78d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ env: # Enable python 2 and python 3 builds # Note that the 2.6 build doesn't get flake8, and runs old versions of # Pyglet and GLFW to make sure we deal with those correctly - #- PYTHON=2.6 QT=pyqt TEST=standard + - PYTHON=2.6 QT=pyqt TEST=standard - PYTHON=2.7 QT=pyqt TEST=extra - PYTHON=2.7 QT=pyside TEST=standard - PYTHON=3.4 QT=pyqt TEST=standard From 4b15fa75d5218171019ab1f48121cf5435fe5bc5 Mon Sep 17 00:00:00 2001 From: Eric Dill Date: Sun, 2 Aug 2015 16:46:41 -0400 Subject: [PATCH 2/7] TST: Use pgcollections.OrderedDict for 2.6 compat --- .travis.yml | 5 +++++ examples/test_examples.py | 15 ++++++++++----- pyqtgraph/parametertree/SystemSolver.py | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3171f78d..f167791c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,6 +65,11 @@ install: - pip install pytest-xdist # multi-thread py.test - pip install pytest-cov # add coverage stats + # required for example testing on python 2.6 + - if [ "${PYTHON}" == "2.6" ]; then + pip install importlib + fi; + # Debugging helpers - uname -a - cat /etc/issue diff --git a/examples/test_examples.py b/examples/test_examples.py index 0f9929ca..6fcee492 100644 --- a/examples/test_examples.py +++ b/examples/test_examples.py @@ -1,15 +1,20 @@ from __future__ import print_function, division, absolute_import from pyqtgraph import Qt -from examples import utils -import importlib +from . import utils import itertools import pytest +# apparently importlib does not exist in python 2.6... +try: + import importlib +except ImportError: + # we are on python 2.6 + print("If you want to test the examples, please install importlib from " + "pypi\n\npip install importlib\n\n") + pass + files = utils.buildFileList(utils.examples) - frontends = {Qt.PYQT4: False, Qt.PYSIDE: False} -# frontends = {Qt.PYQT4: False, Qt.PYQT5: False, Qt.PYSIDE: False} - # sort out which of the front ends are available for frontend in frontends.keys(): try: diff --git a/pyqtgraph/parametertree/SystemSolver.py b/pyqtgraph/parametertree/SystemSolver.py index 0a889dfa..24e35e9a 100644 --- a/pyqtgraph/parametertree/SystemSolver.py +++ b/pyqtgraph/parametertree/SystemSolver.py @@ -1,4 +1,4 @@ -from collections import OrderedDict +from ..pgcollections import OrderedDict import numpy as np class SystemSolver(object): From afbc65325ec45997fd52d655cc2ccd95b928830c Mon Sep 17 00:00:00 2001 From: Eric Dill Date: Sun, 2 Aug 2015 17:18:38 -0400 Subject: [PATCH 3/7] py26: {} cannot be empty for string formatting So that's a nasty gotcha of python 2.6! --- examples/test_examples.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/test_examples.py b/examples/test_examples.py index 6fcee492..3e6b8200 100644 --- a/examples/test_examples.py +++ b/examples/test_examples.py @@ -30,7 +30,7 @@ def test_examples(frontend, f): # Test the examples with all available front-ends print('frontend = %s. f = %s' % (frontend, f)) if not frontends[frontend]: - pytest.skip('{} is not installed. Skipping tests'.format(frontend)) + pytest.skip('%s is not installed. Skipping tests' % frontend) utils.testFile(f[0], f[1], utils.sys.executable, frontend) if __name__ == "__main__": From 13c67aff0b90348b7d2b74ce8998963e041493cd Mon Sep 17 00:00:00 2001 From: Eric Dill Date: Mon, 3 Aug 2015 17:20:54 -0400 Subject: [PATCH 4/7] MNT: Ahh it's the semicolon... --- .travis.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index f167791c..e901c7c5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ before_install: - chmod +x miniconda.sh - ./miniconda.sh -b -p /home/travis/mc - export PATH=/home/travis/mc/bin:$PATH - + # not sure what is if block is for - if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then GIT_TARGET_EXTRA="+refs/heads/${TRAVIS_BRANCH}"; @@ -55,7 +55,7 @@ install: - echo ${QT} - echo ${TEST} - echo ${PYTHON} - + - if [ "${QT}" == "pyqt" ]; then conda install pyqt --yes; fi; @@ -64,12 +64,12 @@ install: fi; - pip install pytest-xdist # multi-thread py.test - pip install pytest-cov # add coverage stats - + # required for example testing on python 2.6 - if [ "${PYTHON}" == "2.6" ]; then - pip install importlib + pip install importlib; fi; - + # Debugging helpers - uname -a - cat /etc/issue @@ -84,7 +84,7 @@ before_script: - export DISPLAY=:99.0 - "sh -e /etc/init.d/xvfb start" - /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1400x900x24 -ac +extension GLX +render - + # Make sure everyone uses the correct python (this is handled by conda) - which python - python --version @@ -132,16 +132,16 @@ before_script: fi; script: - + - source activate test_env - + # Run unit tests - start_test "unit tests"; PYTHONPATH=. py.test --cov pyqtgraph -n 4 -sv; check_output "unit tests"; - echo "test script finished. Current directory:" - pwd - + # check line endings - if [ "${TEST}" == "extra" ]; then start_test "line ending check"; @@ -171,13 +171,13 @@ script: - start_test "install test"; python setup.py --quiet install; check_output "install test"; - + # Check double-install fails # Note the bash -c is because travis strips off the ! otherwise. - start_test "double install test"; bash -c "! python setup.py --quiet install"; check_output "double install test"; - + # Check we can import pg - start_test "import test"; echo "import sys; print(sys.path)" | python && From 51e06c31a722953f4aa7a1c0bb71b8ddd77a78d7 Mon Sep 17 00:00:00 2001 From: Eric Dill Date: Thu, 24 Dec 2015 10:38:31 -0500 Subject: [PATCH 5/7] MNT: Switch to WeakKeyDict --- pyqtgraph/tests/test_stability.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyqtgraph/tests/test_stability.py b/pyqtgraph/tests/test_stability.py index 7582d353..35da955b 100644 --- a/pyqtgraph/tests/test_stability.py +++ b/pyqtgraph/tests/test_stability.py @@ -34,7 +34,7 @@ itemTypes = [ widgets = [] items = [] -allWidgets = weakref.WeakSet() +allWidgets = weakref.WeakKeyDictionary() def crashtest(): @@ -99,7 +99,7 @@ def createWidget(): widget = randItem(widgetTypes)() widget.setWindowTitle(widget.__class__.__name__) widgets.append(widget) - allWidgets.add(widget) + allWidgets['widget'] = 1 p(" %s" % widget) return widget From 21c79d1c4a4d6dfd8f92923c5be23a5bd28cf339 Mon Sep 17 00:00:00 2001 From: Eric Dill Date: Thu, 24 Dec 2015 10:41:17 -0500 Subject: [PATCH 6/7] MNT: Should use the actual widget not 'widget' --- pyqtgraph/tests/test_stability.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyqtgraph/tests/test_stability.py b/pyqtgraph/tests/test_stability.py index 35da955b..810b53bf 100644 --- a/pyqtgraph/tests/test_stability.py +++ b/pyqtgraph/tests/test_stability.py @@ -99,7 +99,7 @@ def createWidget(): widget = randItem(widgetTypes)() widget.setWindowTitle(widget.__class__.__name__) widgets.append(widget) - allWidgets['widget'] = 1 + allWidgets[widget] = 1 p(" %s" % widget) return widget From 55c1554fa23b3ab69b68f27ce13a45804abdd8c7 Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Sat, 2 Jan 2016 23:15:14 -0800 Subject: [PATCH 7/7] Remove parallel unit testing --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e901c7c5..e90828f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -137,7 +137,7 @@ script: # Run unit tests - start_test "unit tests"; - PYTHONPATH=. py.test --cov pyqtgraph -n 4 -sv; + PYTHONPATH=. py.test --cov pyqtgraph -sv; check_output "unit tests"; - echo "test script finished. Current directory:" - pwd