diff --git a/.mailmap b/.mailmap deleted file mode 100644 index 025cf940..00000000 --- a/.mailmap +++ /dev/null @@ -1,12 +0,0 @@ -Luke Campagnola Luke Campagnola <> -Luke Campagnola Luke Campagnola -Megan Kratz meganbkratz@gmail.com <> -Megan Kratz Megan Kratz -Megan Kratz Megan Kratz -Megan Kratz Megan Kratz -Megan Kratz Megan Kratz -Megan Kratz Megan Kratz -Megan Kratz Megan Kratz -Ingo Breßler Ingo Breßler -Ingo Breßler Ingo B. - diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 173fa668..00000000 --- a/.travis.yml +++ /dev/null @@ -1,195 +0,0 @@ -language: python -sudo: false -# Credit: Original .travis.yml lifted from VisPy - -# Here we use anaconda for 2.6 and 3.3, since it provides the simplest -# interface for running different versions of Python. We could also use -# it for 2.7, but the Ubuntu system has installable 2.7 Qt4-GL, which -# allows for more complete testing. -notifications: - email: false - -env: - # Enable python 2 and python 3 builds - # Note that the python 2.6 support ended. - - PYTHON=2.7 QT=pyqt4 TEST=extra - - PYTHON=2.7 QT=pyside TEST=standard - - PYTHON=3.5 QT=pyqt5 TEST=standard - # - PYTHON=3.4 QT=pyside TEST=standard # pyside isn't available for 3.4 with conda - #- PYTHON=3.2 QT=pyqt5 TEST=standard - -services: - - xvfb - -before_install: - - if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then wget http://repo.continuum.io/miniconda/Miniconda-3.5.5-Linux-x86_64.sh -O miniconda.sh; else wget http://repo.continuum.io/miniconda/Miniconda3-3.5.5-Linux-x86_64.sh -O miniconda.sh; fi - - 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}"; - GIT_SOURCE_EXTRA="+refs/pull/${TRAVIS_PULL_REQUEST}/merge"; - else - GIT_TARGET_EXTRA=""; - GIT_SOURCE_EXTRA=""; - fi; - - # to aid in debugging - - echo ${TRAVIS_BRANCH} - - echo ${TRAVIS_REPO_SLUG} - - echo ${GIT_TARGET_EXTRA} - - echo ${GIT_SOURCE_EXTRA} - -install: - - export GIT_FULL_HASH=`git rev-parse HEAD` - - conda update conda --yes - - conda create -n test_env python=${PYTHON} --yes - - source activate test_env - - conda install numpy scipy pyopengl pytest flake8 six coverage --yes - - echo ${QT} - - echo ${TEST} - - echo ${PYTHON} - - - if [ "${QT}" == "pyqt5" ]; then - conda install pyqt --yes; - fi; - - if [ "${QT}" == "pyqt4" ]; then - conda install pyqt=4 --yes; - fi; - - if [ "${QT}" == "pyside" ]; then - conda install pyside --yes; - fi; - - pip install pytest-xdist # multi-thread pytest - - pip install pytest-cov # add coverage stats - - # faulthandler support not built in to pytest for python 2.7 - - if [ "${PYTHON}" == "2.7" ]; then - pip install pytest-faulthandler; - export PYTEST_ADDOPTS="--faulthandler-timeout=15"; - fi; - - # Debugging helpers - - uname -a - - cat /etc/issue - - if [ "${PYTHON}" == "2.7" ]; then - python --version; - else - python3 --version; - fi; - -before_script: - # We need to create a (fake) display on Travis, let's use a funny resolution - - export DISPLAY=:99.0 - - /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 - - pwd - - ls - # Help color output from each test - - RESET='\033[0m'; - RED='\033[00;31m'; - GREEN='\033[00;32m'; - YELLOW='\033[00;33m'; - BLUE='\033[00;34m'; - PURPLE='\033[00;35m'; - CYAN='\033[00;36m'; - WHITE='\033[00;37m'; - start_test() { - echo -e "${BLUE}======== Starting $1 ========${RESET}"; - }; - check_output() { - ret=$?; - if [ $ret == 0 ]; then - echo -e "${GREEN}>>>>>> $1 passed <<<<<<${RESET}"; - else - echo -e "${RED}>>>>>> $1 FAILED <<<<<<${RESET}"; - fi; - return $ret; - }; - - - if [ "${TEST}" == "extra" ]; then - start_test "repo size check"; - mkdir ~/repo-clone && cd ~/repo-clone && - git init && git remote add -t ${TRAVIS_BRANCH} origin git://github.com/${TRAVIS_REPO_SLUG}.git && - git fetch origin ${GIT_TARGET_EXTRA} && - git checkout -qf FETCH_HEAD && - git tag travis-merge-target && - git gc --aggressive && - TARGET_SIZE=`du -s . | sed -e "s/\t.*//"` && - git pull origin ${GIT_SOURCE_EXTRA} && - git gc --aggressive && - MERGE_SIZE=`du -s . | sed -e "s/\t.*//"` && - if [ "${MERGE_SIZE}" != "${TARGET_SIZE}" ]; then - SIZE_DIFF=`expr \( ${MERGE_SIZE} - ${TARGET_SIZE} \)`; - else - SIZE_DIFF=0; - fi; - fi; - -script: - - - source activate test_env - - # Check system info - - python -c "import pyqtgraph as pg; pg.systemInfo()" - - - # Check install works - - start_test "install test"; - python setup.py --quiet install; - check_output "install test"; - - # Run unit tests - - start_test "unit tests"; - PYTHONPATH=. pytest --cov pyqtgraph -sv; - check_output "unit tests"; - - echo "test script finished. Current directory:" - - pwd - - # check line endings - - if [ "${TEST}" == "extra" ]; then - start_test "line ending check"; - ! find ./ -name "*.py" | xargs file | grep CRLF && - ! find ./ -name "*.rst" | xargs file | grep CRLF; - check_output "line ending check"; - fi; - - # Check repo size does not expand too much - - if [ "${TEST}" == "extra" ]; then - start_test "repo size check"; - echo -e "Estimated content size difference = ${SIZE_DIFF} kB" && - test ${SIZE_DIFF} -lt 100; - check_output "repo size check"; - fi; - - # Check for style issues - - if [ "${TEST}" == "extra" ]; then - start_test "style check"; - cd ~/repo-clone && - git reset -q travis-merge-target && - python setup.py style && - check_output "style check"; - fi; - - # 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 && - cd /; echo "import pyqtgraph.examples" | python; - check_output "import test"; - -after_success: - - cd /home/travis/build/pyqtgraph/pyqtgraph - - pip install codecov --upgrade # add coverage integration service - - codecov - - pip install coveralls --upgrade # add another coverage integration service - - coveralls diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9af2e508..461e9b14 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,11 +9,14 @@ Please use the following guidelines when preparing changes: * The preferred method for submitting changes is by github pull request against the "develop" branch. * Pull requests should include only a focused and related set of changes. Mixed features and unrelated changes may be rejected. * For major changes, it is recommended to discuss your plans on the mailing list or in a github issue before putting in too much effort. - * Along these lines, please note that `pyqtgraph.opengl` will be deprecated soon and replaced with VisPy. +* The following deprecations are being considered by the maintainers + * `pyqtgraph.opengl` may be deprecated and replaced with `VisPy` functionality + * After v0.11, pyqtgraph will adopt [NEP-29](https://numpy.org/neps/nep-0029-deprecation_policy.html) which will effectively mean that python2 support will be deprecated + * Qt4 will be deprecated shortly, as well as Qt5<5.9 (and potentially <5.12) ## Documentation -* Writing proper documentation and unit tests is highly encouraged. PyQtGraph uses nose / pytest style testing, so tests should usually be included in a tests/ directory adjacent to the relevant code. +* Writing proper documentation and unit tests is highly encouraged. PyQtGraph uses pytest style testing, so tests should usually be included in a tests/ directory adjacent to the relevant code. * Documentation is generated with sphinx; please check that docstring changes compile correctly ## Style guidelines @@ -55,9 +58,7 @@ To make use of `pre-commit`, have it available in your `$PATH` and run `pre-comm * pytest-xdist * Optional: pytest-xvfb -If you have pytest < 5, you may also want to install the pytest-faulthandler -plugin to output extra debugging information in case of test failures. This -isn't necessary with pytest 5+ as the plugin was merged into core pytest. +If you have `pytest<5` (used in python2), you may also want to install `pytest-faulthandler==1.6` plugin to output extra debugging information in case of test failures. This isn't necessary with `pytest>=5` ### Tox @@ -68,13 +69,4 @@ As PyQtGraph supports a wide array of Qt-bindings, and python versions, we make ### Continous Integration -For our Continuous Integration, we utilize Azure Pipelines. On each OS, we test the following 6 configurations - -* Python2.7 with PyQt4 -* Python2.7 with PySide -* Python3.6 with PyQt5-5.9 -* Python3.6 with PySide2-5.9 -* Python3.7 with PyQt5-5.12 -* Python3.7 with PySide2-5.12 - -More information on coverage and test failures can be found on the respective tabs of the [build results page](https://dev.azure.com/pyqtgraph/pyqtgraph/_build?definitionId=1) +For our Continuous Integration, we utilize Azure Pipelines. Tested configurations are visible on [README](README.md). More information on coverage and test failures can be found on the respective tabs of the [build results page](https://dev.azure.com/pyqtgraph/pyqtgraph/_build?definitionId=1) diff --git a/README.md b/README.md index 914523fd..b461f4f6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ [![Build Status](https://pyqtgraph.visualstudio.com/pyqtgraph/_apis/build/status/pyqtgraph.pyqtgraph?branchName=develop)](https://pyqtgraph.visualstudio.com/pyqtgraph/_build/latest?definitionId=17&branchName=develop) - PyQtGraph ========= @@ -20,7 +19,8 @@ Requirements ------------ * PyQt 4.8+, PySide, PyQt5, or PySide2 -* python 2.7, or 3.x + * PySide2 5.14 does not have loadUiType functionality, and thus the example application will not work. You can follow along with restoring that functionality [here](https://bugreports.qt.io/browse/PYSIDE-1223). +* Python 2.7, or 3.x * Required * `numpy` * Optional @@ -34,14 +34,15 @@ Requirements Qt Bindings Test Matrix ----------------------- -Below is a table of the configurations we test and have confidence pyqtgraph will work with. All current operating major operating systems (Windows, macOS, Linux) are tested against this configuration. We recommend using the Qt 5.12 or 5.9 (either PyQt5 or PySide2) bindings. +The following table represents the python environments we test in our CI system. Our CI system uses Ubuntu 18.04, Windows Server 2019, and macOS 10.15 base images. -| Python Version | PyQt4 | PySide | PyQt5-5.6 | PySide2-5.6 | PyQt5-5.9 | PySide2-5.9 | PyQt5-5.12 | PySide2 5.12 | -| :-------------- | :----------------: | :----------------: | :----------------: | :----------------: | :----------------: | :----------------: | :----------------: | :----------------: | -| 2.7 | :white_check_mark: | :white_check_mark: | :x: | :x: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | -| 3.5 | :x: | :x: | :white_check_mark: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | -| 3.6 | :x: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| 3.7 | :x: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Qt-Bindings | Python 2.7 | Python 3.6 | Python 3.7 | Python 3.8 | +| :----------- | :----------------: | :----------------: | :----------------: | :----------------: | +| PyQt-4 | :white_check_mark: | :x: | :x: | :x: | +| PySide1 | :white_check_mark: | :x: | :x: | :x: | +| PyQt-5.9 | :x: | :white_check_mark: | :x: | :x: | +| PySide2-5.13 | :x: | :x: | :white_check_mark: | :x: | +| PyQt-5.14 | :x: | :x: | :x: | :white_check_mark: | * pyqtgraph has had some incompatabilities with PySide2-5.6, and we recommend you avoid those bindings if possible * on macOS with Python 2.7 and Qt4 bindings (PyQt4 or PySide) the openGL related visualizations do not work diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 657189f8..eb379119 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,13 +17,14 @@ pr: variables: OFFICIAL_REPO: 'pyqtgraph/pyqtgraph' DEFAULT_MERGE_BRANCH: 'develop' + disable.coverage.autogenerate: 'true' stages: - stage: "pre_test" jobs: - job: check_diff_size pool: - vmImage: 'Ubuntu 16.04' + vmImage: 'Ubuntu 18.04' steps: - bash: | git config --global advice.detachedHead false @@ -56,7 +57,7 @@ stages: - job: "style_check" pool: - vmImage: "Ubuntu 16.04" + vmImage: "Ubuntu 18.04" steps: - task: UsePythonVersion@0 inputs: @@ -69,11 +70,11 @@ stages: - job: "build_wheel" pool: - vmImage: 'Ubuntu 16.04' + vmImage: 'Ubuntu 18.04' steps: - task: UsePythonVersion@0 inputs: - versionSpec: 3.7 + versionSpec: 3.8 - script: | python -m pip install setuptools wheel python setup.py bdist_wheel --universal @@ -87,12 +88,12 @@ stages: - template: azure-test-template.yml parameters: name: linux - vmImage: 'Ubuntu 16.04' + vmImage: 'Ubuntu 18.04' - template: azure-test-template.yml parameters: name: windows - vmImage: 'vs2017-win2016' + vmImage: 'windows-2019' - template: azure-test-template.yml parameters: name: macOS - vmImage: 'macOS-10.13' + vmImage: 'macOS-10.15' diff --git a/azure-test-template.yml b/azure-test-template.yml index 5d204009..04fd7e42 100644 --- a/azure-test-template.yml +++ b/azure-test-template.yml @@ -22,17 +22,13 @@ jobs: python.version: "3.6" qt.bindings: "pyqt" install.method: "conda" - Python36-PySide2-5.9: - python.version: "3.6" - qt.bindings: "pyside2" - install.method: "conda" - Python37-PyQt-5.13: - python.version: '3.7' - qt.bindings: "PyQt5" - install.method: "pip" Python37-PySide2-5.13: python.version: "3.7" - qt.bindings: "PySide2" + qt.bindings: "pyside2" + install.method: "conda" + Python38-PyQt-5.14: + python.version: '3.8' + qt.bindings: "PyQt5" install.method: "pip" steps: @@ -75,22 +71,10 @@ jobs: if [ $(agent.os) == 'Linux' ] then echo "##vso[task.prependpath]$CONDA/bin" - if [ $(python.version) == '2.7' ] - then - echo "Grabbing Older Miniconda" - wget https://repo.anaconda.com/miniconda/Miniconda2-4.6.14-Linux-x86_64.sh -O Miniconda.sh - bash Miniconda.sh -b -p $CONDA -f - fi elif [ $(agent.os) == 'Darwin' ] then sudo chown -R $USER $CONDA echo "##vso[task.prependpath]$CONDA/bin" - if [ $(python.version) == '2.7' ] - then - echo "Grabbing Older Miniconda" - wget https://repo.anaconda.com/miniconda/Miniconda2-4.6.14-MacOSX-x86_64.sh -O Miniconda.sh - bash Miniconda.sh -b -p $CONDA -f - fi elif [ $(agent.os) == 'Windows_NT' ] then echo "##vso[task.prependpath]$CONDA/Scripts" @@ -99,33 +83,35 @@ jobs: fi displayName: 'Add Conda To $PATH' condition: eq(variables['install.method'], 'conda' ) + continueOnError: false - bash: | if [ $(install.method) == "conda" ] then - conda create --name test-environment-$(python.version) python=$(python.version) --yes - echo "Conda Info:" - conda info - echo "Installing qt-bindings" + conda update --all --yes --quiet + conda create --name test-environment-$(python.version) python=$(python.version) --yes --quiet source activate test-environment-$(python.version) - - if [ $(agent.os) == "Linux" ] && [ $(python.version) == "2.7" ] + conda config --env --set always_yes true + if [ $(python.version) == '2.7' ] then - conda install $(qt.bindings) --yes - else - conda install -c conda-forge $(qt.bindings) --yes + conda config --set restore_free_channel true fi - echo "Installing remainder of dependencies" - conda install -c conda-forge numpy scipy six pyopengl h5py --yes + if [ $(qt.bindings) == "pyside2" ] || ([ $(qt.bindings) == 'pyside' ] && [ $(agent.os) == 'Darwin' ]) + then + conda config --prepend channels conda-forge + fi + conda info + conda install $(qt.bindings) numpy scipy pyopengl h5py six --yes --quiet else - pip install $(qt.bindings) numpy scipy pyopengl six h5py + pip install $(qt.bindings) numpy scipy pyopengl h5py six fi - echo "" - pip install pytest pytest-xdist pytest-cov coverage + pip install pytest pytest-cov coverage pytest-xdist if [ $(python.version) == "2.7" ] then pip install pytest-faulthandler==1.6.0 export PYTEST_ADDOPTS="--faulthandler-timeout=15" + else + pip install pytest pytest-cov coverage fi displayName: "Install Dependencies" @@ -180,9 +166,10 @@ jobs: mkdir -p "$SCREENSHOT_DIR" # echo "If Screenshots are generated, they may be downloaded from:" # echo "https://dev.azure.com/pyqtgraph/pyqtgraph/_apis/build/builds/$(Build.BuildId)/artifacts?artifactName=Screenshots&api-version=5.0" - pytest . -sv \ + pytest . -v \ + -n 1 \ --junitxml=junit/test-results.xml \ - -n 1 --cov pyqtgraph --cov-report=xml --cov-report=html + --cov pyqtgraph --cov-report=xml --cov-report=html displayName: 'Unit tests' env: AZURE: 1 diff --git a/examples/test_examples.py b/examples/test_examples.py index c6fef377..f10fe358 100644 --- a/examples/test_examples.py +++ b/examples/test_examples.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import -from pyqtgraph import Qt from . import utils from collections import namedtuple +from pyqtgraph import Qt import errno import importlib import itertools @@ -150,6 +150,7 @@ conditionalExamples = { ) } +@pytest.mark.skipif(Qt.QT_LIB == "PySide2" and "Qt.QtVersion.startswith('5.14')", reason="new PySide2 doesn't have loadUi functionality") @pytest.mark.parametrize( "frontend, f", [ diff --git a/pyqtgraph/graphicsItems/AxisItem.py b/pyqtgraph/graphicsItems/AxisItem.py index da57403f..2601ecae 100644 --- a/pyqtgraph/graphicsItems/AxisItem.py +++ b/pyqtgraph/graphicsItems/AxisItem.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from ..Qt import QtGui, QtCore from ..python2_3 import asUnicode import numpy as np @@ -921,7 +922,7 @@ class AxisItem(GraphicsWidget): p2[axis] += tickLength*tickDir tickPen = self.pen() color = tickPen.color() - color.setAlpha(lineAlpha) + color.setAlpha(int(lineAlpha)) tickPen.setColor(color) tickSpecs.append((tickPen, Point(p1), Point(p2))) profiler('compute ticks') @@ -1078,7 +1079,7 @@ class AxisItem(GraphicsWidget): p.setFont(self.tickFont) p.setPen(self.textPen()) for rect, flags, text in textSpecs: - p.drawText(rect, flags, text) + p.drawText(rect, int(flags), text) profiler('draw text') diff --git a/pyqtgraph/graphicsItems/GradientEditorItem.py b/pyqtgraph/graphicsItems/GradientEditorItem.py index b360b2f7..1cb11d1c 100644 --- a/pyqtgraph/graphicsItems/GradientEditorItem.py +++ b/pyqtgraph/graphicsItems/GradientEditorItem.py @@ -654,7 +654,7 @@ class GradientEditorItem(TickSliderItem): s = s1 * (1.-f) + s2 * f v = v1 * (1.-f) + v2 * f c = QtGui.QColor() - c.setHsv(h,s,v) + c.setHsv(*map(int, [h,s,v])) if toQColor: return c else: diff --git a/pyqtgraph/graphicsItems/GridItem.py b/pyqtgraph/graphicsItems/GridItem.py index 0b1eb525..db64cbbf 100644 --- a/pyqtgraph/graphicsItems/GridItem.py +++ b/pyqtgraph/graphicsItems/GridItem.py @@ -153,7 +153,7 @@ class GridItem(UIGraphicsItem): continue ppl = dim[ax] / nl[ax] - c = np.clip(5.*(ppl-3), 0., 50.) + c = np.clip(5 * (ppl-3), 0., 50.).astype(int) linePen = self.opts['pen'] lineColor = self.opts['pen'].color() diff --git a/pyqtgraph/graphicsItems/tests/test_ROI.py b/pyqtgraph/graphicsItems/tests/test_ROI.py index 33a18217..10c6009b 100644 --- a/pyqtgraph/graphicsItems/tests/test_ROI.py +++ b/pyqtgraph/graphicsItems/tests/test_ROI.py @@ -1,14 +1,14 @@ +# -*- coding: utf-8 -*- import sys import numpy as np import pytest import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtTest from pyqtgraph.tests import assertImageApproved, mouseMove, mouseDrag, mouseClick, TransposedImageItem, resizeWindow - +import pytest app = pg.mkQApp() - def test_getArrayRegion(transpose=False): pr = pg.PolyLineROI([[0, 0], [27, 0], [0, 28]], closed=True) pr.setPos(1, 1) @@ -33,7 +33,6 @@ def test_getArrayRegion(transpose=False): finally: pg.setConfigOptions(imageAxisOrder=origMode) - def test_getArrayRegion_axisorder(): test_getArrayRegion(transpose=True) @@ -135,7 +134,7 @@ def check_getArrayRegion(roi, name, testResize=True, transpose=False): img2.setImage(rgn[0, ..., 0]) app.processEvents() # on windows, one edge of one ROI handle is shifted slightly; letting this slide with pxCount=10 - if sys.platform == 'win32' and pg.Qt.QT_LIB in ('PyQt4', 'PySide'): + if pg.Qt.QT_LIB in {'PyQt4', 'PySide'}: pxCount = 10 else: pxCount=-1 diff --git a/pyqtgraph/tests/test_functions.py b/pyqtgraph/tests/test_functions.py index fcd16254..6a6aaa33 100644 --- a/pyqtgraph/tests/test_functions.py +++ b/pyqtgraph/tests/test_functions.py @@ -367,8 +367,10 @@ def test_eq(): d1 = {'x': 1, 'y': np.nan, 3: ['a', np.nan, a3, 7, 2.3], 4: a4} d2 = deepcopy(d1) assert eq(d1, d2) - assert eq(OrderedDict(d1), OrderedDict(d2)) - assert not eq(OrderedDict(d1), d2) + d1_ordered = OrderedDict(d1) + d2_ordered = deepcopy(d1_ordered) + assert eq(d1_ordered, d2_ordered) + assert not eq(d1_ordered, d2) items = list(d1.items()) assert not eq(OrderedDict(items), OrderedDict(reversed(items))) diff --git a/pyqtgraph/tests/test_qt.py b/pyqtgraph/tests/test_qt.py index c86cd500..9a4f373b 100644 --- a/pyqtgraph/tests/test_qt.py +++ b/pyqtgraph/tests/test_qt.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import pyqtgraph as pg import gc, os import pytest @@ -14,6 +15,7 @@ def test_isQObjectAlive(): @pytest.mark.skipif(pg.Qt.QT_LIB == 'PySide', reason='pysideuic does not appear to be ' 'packaged with conda') +@pytest.mark.skipif(pg.Qt.QT_LIB == "PySide2" and "pg.Qt.QtVersion.startswith('5.14')", reason="new PySide2 doesn't have loadUi functionality") def test_loadUiType(): path = os.path.dirname(__file__) formClass, baseClass = pg.Qt.loadUiType(os.path.join(path, 'uictest.ui')) diff --git a/pyqtgraph/tests/test_ref_cycles.py b/pyqtgraph/tests/test_ref_cycles.py index e05c4ef1..121a09e4 100644 --- a/pyqtgraph/tests/test_ref_cycles.py +++ b/pyqtgraph/tests/test_ref_cycles.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """ Test for unwanted reference cycles @@ -9,9 +10,7 @@ import six import pytest app = pg.mkQApp() -skipreason = ('unclear why test is failing on python 3. skipping until someone ' - 'has time to fix it. Or pyside is being used. This test is ' - 'failing on pyside for an unknown reason too.') +skipreason = ('This test is failing on pyside and pyside2 for an unknown reason.') def assert_alldead(refs): for ref in refs: @@ -36,11 +35,10 @@ def mkrefs(*objs): obj = [obj] for o in obj: allObjs[id(o)] = o - - return map(weakref.ref, allObjs.values()) + return [weakref.ref(obj) for obj in allObjs.values()] -@pytest.mark.skipif(six.PY3 or pg.Qt.QT_LIB == 'PySide', reason=skipreason) +@pytest.mark.skipif(pg.Qt.QT_LIB in {'PySide', 'PySide2'}, reason=skipreason) def test_PlotWidget(): def mkobjs(*args, **kwds): w = pg.PlotWidget(*args, **kwds) @@ -58,7 +56,7 @@ def test_PlotWidget(): for i in range(5): assert_alldead(mkobjs()) -@pytest.mark.skipif(six.PY3 or pg.Qt.QT_LIB == 'PySide', reason=skipreason) +@pytest.mark.skipif(pg.Qt.QT_LIB in {'PySide', 'PySide2'}, reason=skipreason) def test_ImageView(): def mkobjs(): iv = pg.ImageView() @@ -66,12 +64,12 @@ def test_ImageView(): iv.setImage(data) return mkrefs(iv, iv.imageItem, iv.view, iv.ui.histogram, data) - for i in range(5): + gc.collect() assert_alldead(mkobjs()) -@pytest.mark.skipif(six.PY3 or pg.Qt.QT_LIB == 'PySide', reason=skipreason) +@pytest.mark.skipif(pg.Qt.QT_LIB in {'PySide', 'PySide2'}, reason=skipreason) def test_GraphicsWindow(): def mkobjs(): w = pg.GraphicsWindow() diff --git a/pytest.ini b/pytest.ini index f53aea00..355e9dfd 100644 --- a/pytest.ini +++ b/pytest.ini @@ -12,4 +12,8 @@ filterwarnings = ignore:numpy.ufunc size changed, may indicate binary incompatibility.*:RuntimeWarning # Warnings generated from PyQt5.9 ignore:This method will be removed in future versions. Use 'tree.iter\(\)' or 'list\(tree.iter\(\)\)' instead.:PendingDeprecationWarning - ignore:'U' mode is deprecated\nplugin = open\(filename, 'rU'\):DeprecationWarning + ignore:.*'U' mode is deprecated.*:DeprecationWarning + # py36/pyside2_512 specific issue + ignore:split\(\) requires a non-empty pattern match\.:FutureWarning + # pyqtgraph specific warning we want to ignore during testing + ignore:Visible window deleted. To prevent this, store a reference to the window object. \ No newline at end of file diff --git a/tox.ini b/tox.ini index 9091c8cb..130085ba 100644 --- a/tox.ini +++ b/tox.ini @@ -1,22 +1,16 @@ [tox] envlist = - ; qt 5.12.x - py{27,37}-pyside2-pip - py{35,37}-pyqt5-pip + ; qt latest + py{37,38}-{pyqt5,pyside2}_latest - ; qt 5.9.7 - py{27,37}-pyqt5-conda - py{27,37}-pyside2-conda + ; qt 5.12.x (LTS) + py{36,37}-{pyqt5,pyside2}_512 - ; qt 5.6.2 - py35-pyqt5-conda - ; consider dropping support... - ; py35-pyside2-conda + ; qt 5.9.7 (LTS) + py36-{pyqt5,pyside2}_59_conda ; qt 4.8.7 - py{27,36}-pyqt4-conda - py{27,36}-pyside-conda - + py27-{pyqt4,pyside}_conda [base] deps = @@ -30,21 +24,26 @@ deps = [testenv] passenv = DISPLAY XAUTHORITY +setenv = PYTHONWARNINGS=ignore:DEPRECATION::pip._internal.cli.base_command deps= {[base]deps} pytest-cov - pytest-xdist - pyside2-pip: pyside2 - pyqt5-pip: pyqt5 + h5py + pyside2_512: pyside2>=5.12,<5.13 + pyqt5_512: pyqt5>=5.12,<5.13 + pyside2_latest: pyside2 + pyqt5_latest: pyqt5 conda_deps= - pyside2-conda: pyside2 - pyside-conda: pyside - pyqt5-conda: pyqt - pyqt4-conda: pyqt=4 - + pyside2_59_conda: pyside2=5.9 + pyqt5_59_conda: pyqt=5.9 + pyqt4_conda: pyqt=4 + pyside_conda: pyside + conda_channels= conda-forge + free + commands= python -c "import pyqtgraph as pg; pg.systemInfo()" - pytest {posargs:.} + pytest {posargs:}