Merge pull request #262 from campagnola/py26compat

Py26compat
This commit is contained in:
Luke Campagnola 2016-01-02 23:23:11 -08:00
commit 9e8c2082ed
4 changed files with 30 additions and 20 deletions

View File

@ -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
@ -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
@ -132,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

View File

@ -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:
@ -25,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__":

View File

@ -1,4 +1,4 @@
from collections import OrderedDict
from ..pgcollections import OrderedDict
import numpy as np
class SystemSolver(object):

View File

@ -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