diff -Nru python-qwt-0.8.1/CHANGELOG.md python-qwt-0.8.3/CHANGELOG.md --- python-qwt-0.8.1/CHANGELOG.md 2020-08-24 21:12:25.000000000 +0000 +++ python-qwt-0.8.3/CHANGELOG.md 2020-08-31 08:26:03.000000000 +0000 @@ -1,5 +1,19 @@ # PythonQwt Releases # +### Version 0.8.3 ### + +- Fixed simple plot examples (setup.py & plot.py's doc page) following the introduction + of the new QtPy dependency (Qt compatibility layer) since V0.8.0. + +### Version 0.8.2 ### + +- Added new GUI-based test script `PythonQwt-py3` to run the test launcher. +- Added command-line options to the `PythonQwt-tests-py3` script to run all the tests + simultenously in unattended mode (`--mode unattended`) or to update all the + screenshots (`--mode screenshots`). +- Added internal scripts for automated test in virtual environments with both PyQt5 and + PySide2. + ### Version 0.8.1 ### - PySide2 support was significatively improved betwen PythonQwt V0.8.0 and diff -Nru python-qwt-0.8.1/debian/changelog python-qwt-0.8.3/debian/changelog --- python-qwt-0.8.1/debian/changelog 2020-08-27 09:21:35.000000000 +0000 +++ python-qwt-0.8.3/debian/changelog 2020-09-01 09:11:10.000000000 +0000 @@ -1,3 +1,10 @@ +python-qwt (0.8.3-1) unstable; urgency=medium + + * New upstream version 0.8.3 + * d/t/control: Used the provided script for the integration tests + + -- Picca Frédéric-Emmanuel Tue, 01 Sep 2020 11:11:10 +0200 + python-qwt (0.8.1-2) unstable; urgency=medium * d/control: Added Build-Depends, xauth and xvfb for tests diff -Nru python-qwt-0.8.1/debian/rules python-qwt-0.8.3/debian/rules --- python-qwt-0.8.1/debian/rules 2020-08-27 09:21:35.000000000 +0000 +++ python-qwt-0.8.3/debian/rules 2020-09-01 09:11:10.000000000 +0000 @@ -1,6 +1,7 @@ #!/usr/bin/make -f # -*- makefile -*- +export DH_VERBOSE=1 export PYBUILD_NAME=qwt %: @@ -16,9 +17,11 @@ override_dh_auto_build: dh_auto_build - PYTHONPATH=. http_proxy='127.0.0.1:9' sphinx-build -N -bhtml doc/ build/html # HTML generator + # do not build the doc for now, it hang on the CI + PYTHONPATH=. http_proxy='127.0.0.1:9' sphinx-build -vvv -N -bhtml doc/ build/html # HTML generator -override_dh_auto_test: export TEST_UNATTENDED=1 +override_dh_auto_test: export PYTHONQWT_UNATTENDED_TESTS=1 override_dh_auto_test: - # dh_auto_test -- -s custom --test-args="xvfb-run -a --server-args=\"-screen 0 1024x768x24\" {interpreter} -m qwt.tests" + # use the next line to debug unittest without xvfb + # dh_auto_test -- -s custom --test-args="{interpreter} -m qwt.tests.__init__" dh_auto_test -- -s custom --test-args="xvfb-run -a --server-args=\"-screen 0 1024x768x24\" {interpreter} -m qwt.tests.__init__" diff -Nru python-qwt-0.8.1/debian/tests/control python-qwt-0.8.3/debian/tests/control --- python-qwt-0.8.1/debian/tests/control 2020-08-27 09:21:35.000000000 +0000 +++ python-qwt-0.8.3/debian/tests/control 2020-09-01 09:11:10.000000000 +0000 @@ -2,8 +2,7 @@ ; for py in $(py3versions -r 2>/dev/null) ; do cd "$AUTOPKGTEST_TMP" ; echo "Testing with $py:" - ; export TEST_UNATTENDED=1 - ; xvfb-run -a --server-args="-screen 0 1024x768x24" $py -m qwt.tests.__init__ + ; xvfb-run -a --server-args="-screen 0 1024x768x24" $py /usr/bin/PythonQwt-tests-py3 --mode unattended ; done Depends: python3-all, python3-qwt, xauth, xvfb Restrictions: allow-stderr diff -Nru python-qwt-0.8.1/doc/examples/index.rst python-qwt-0.8.3/doc/examples/index.rst --- python-qwt-0.8.1/doc/examples/index.rst 2020-08-15 13:50:12.000000000 +0000 +++ python-qwt-0.8.3/doc/examples/index.rst 2020-08-31 08:26:03.000000000 +0000 @@ -6,19 +6,26 @@ The test launcher ----------------- -A lot of examples are available in the `qwt.test` module :: +A lot of examples are available in the ``qwt.test`` module :: from qwt import tests tests.run() -The two lines above execute the `PythonQwt` test launcher: +The two lines above execute the ``PythonQwt`` test launcher: .. image:: /../qwt/tests/data/testlauncher.png +GUI-based test launcher can be executed from the command line thanks to the +``PythonQwt-py3`` test script (or ``PythonQwt-py2`` for Python 2). + +Unit tests may be executed from the commande line thanks to the console-based script +``PythonQwt-tests-py3``: ``PythonQwt-tests-py3 --mode unattended``. Tests ----- + + Here are some examples from the `qwt.test` module: .. toctree:: diff -Nru python-qwt-0.8.1/doc/index.rst python-qwt-0.8.3/doc/index.rst --- python-qwt-0.8.1/doc/index.rst 2020-08-17 09:05:05.000000000 +0000 +++ python-qwt-0.8.3/doc/index.rst 2020-08-31 08:26:03.000000000 +0000 @@ -4,7 +4,7 @@ .. note:: - Windows users may download the :download:`CHM Manual `. + Windows users may download the :download:`CHM Manual <_downloads/PythonQwt.chm.zip>`. After downloading this file, you may see blank pages in the documentation. That's because Windows is blocking CHM files for security reasons. diff -Nru python-qwt-0.8.1/doc/plot_example.py python-qwt-0.8.3/doc/plot_example.py --- python-qwt-0.8.1/doc/plot_example.py 2020-08-23 07:40:07.000000000 +0000 +++ python-qwt-0.8.3/doc/plot_example.py 2020-08-31 08:26:03.000000000 +0000 @@ -1,7 +1,8 @@ +from qtpy import QtWidgets as QW import qwt import numpy as np -app = qtpy.QtGui.QApplication([]) +app = QW.QApplication([]) x = np.linspace(-10, 10, 500) plot = qwt.QwtPlot("Trigonometric functions") plot.insertLegend(qwt.QwtLegend(), qwt.QwtPlot.BottomLegend) Binary files /tmp/tmpOnYIxi/ISOGNhPsex/python-qwt-0.8.1/doc/PythonQwt.chm.zip and /tmp/tmpOnYIxi/MAzqNEhZzL/python-qwt-0.8.3/doc/PythonQwt.chm.zip differ diff -Nru python-qwt-0.8.1/doc/symbol_path_example.py python-qwt-0.8.3/doc/symbol_path_example.py --- python-qwt-0.8.1/doc/symbol_path_example.py 2020-08-23 07:40:07.000000000 +0000 +++ python-qwt-0.8.3/doc/symbol_path_example.py 2020-08-31 08:26:03.000000000 +0000 @@ -1,14 +1,15 @@ -from qtpy.QtGui import QApplication, QPen, QPainterPath, QTransform -from qtpy.QtCore import Qt, QPointF -from qwt import QwtPlot, QwtPlotCurve, QwtSymbol +from qtpy import QtWidgets as QW +from qtpy import QtGui as QG +from qtpy import QtCore as QC +import qwt import numpy as np import os.path as osp -app = QApplication([]) +app = QW.QApplication([]) # --- Construct custom symbol --- -path = QPainterPath() +path = QG.QPainterPath() path.moveTo(0, 8) path.lineTo(0, 5) path.lineTo(-3, 5) @@ -16,31 +17,31 @@ path.lineTo(3, 5) path.lineTo(0, 5) -transform = QTransform() +transform = QG.QTransform() transform.rotate(-30.0) path = transform.map(path) -pen = QPen(Qt.black, 2) -pen.setJoinStyle(Qt.MiterJoin) +pen = QG.QPen(QC.Qt.black, 2) +pen.setJoinStyle(QC.Qt.MiterJoin) -symbol = QwtSymbol() +symbol = qwt.QwtSymbol() symbol.setPen(pen) -symbol.setBrush(Qt.red) +symbol.setBrush(QC.Qt.red) symbol.setPath(path) -symbol.setPinPoint(QPointF(0.0, 0.0)) +symbol.setPinPoint(QC.QPointF(0.0, 0.0)) symbol.setSize(10, 14) # --- Test it within a simple plot --- -curve = QwtPlotCurve() -curve_pen = QPen(Qt.blue) -curve_pen.setStyle(Qt.DotLine) +curve = qwt.QwtPlotCurve() +curve_pen = QG.QPen(QC.Qt.blue) +curve_pen.setStyle(QC.Qt.DotLine) curve.setPen(curve_pen) curve.setSymbol(symbol) x = np.linspace(0, 10, 10) curve.setData(x, np.sin(x)) -plot = QwtPlot() +plot = qwt.QwtPlot() curve.attach(plot) plot.resize(600, 300) plot.replot() diff -Nru python-qwt-0.8.1/PKG-INFO python-qwt-0.8.3/PKG-INFO --- python-qwt-0.8.1/PKG-INFO 2020-08-24 21:27:06.747176400 +0000 +++ python-qwt-0.8.3/PKG-INFO 2020-08-31 08:26:03.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: PythonQwt -Version: 0.8.1 +Version: 0.8.3 Summary: Qt plotting widgets for Python Home-page: https://github.com/PierreRaybaut/PythonQwt Author: Pierre Raybaut @@ -31,10 +31,11 @@ The following example is a good starting point to see how to set up a simple plot widget:: + from qtpy import QtWidgets as QW import qwt import numpy as np - app = qtpy.QtGui.QApplication([]) + app = QW.QApplication([]) x = np.linspace(-10, 10, 500) plot = qwt.QwtPlot("Trigonometric functions") plot.insertLegend(qwt.QwtLegend(), qwt.QwtPlot.BottomLegend) @@ -42,6 +43,7 @@ qwt.QwtPlotCurve.make(x, np.sin(x), "Sinus", plot, linecolor="blue", antialiased=True) plot.resize(600, 300) plot.show() + app.exec_() .. image:: https://raw.githubusercontent.com/PierreRaybaut/PythonQwt/master/doc/images/QwtPlot_example.png diff -Nru python-qwt-0.8.1/PythonQwt.egg-info/entry_points.txt python-qwt-0.8.3/PythonQwt.egg-info/entry_points.txt --- python-qwt-0.8.1/PythonQwt.egg-info/entry_points.txt 2020-08-24 21:27:06.000000000 +0000 +++ python-qwt-0.8.3/PythonQwt.egg-info/entry_points.txt 2020-08-31 08:26:03.000000000 +0000 @@ -1,3 +1,6 @@ -[gui_scripts] +[console_scripts] PythonQwt-tests-py3 = qwt.tests:run [tests] +[gui_scripts] +PythonQwt-py3 = qwt.tests:run [tests] + diff -Nru python-qwt-0.8.1/PythonQwt.egg-info/PKG-INFO python-qwt-0.8.3/PythonQwt.egg-info/PKG-INFO --- python-qwt-0.8.1/PythonQwt.egg-info/PKG-INFO 2020-08-24 21:27:06.000000000 +0000 +++ python-qwt-0.8.3/PythonQwt.egg-info/PKG-INFO 2020-08-31 08:26:03.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: PythonQwt -Version: 0.8.1 +Version: 0.8.3 Summary: Qt plotting widgets for Python Home-page: https://github.com/PierreRaybaut/PythonQwt Author: Pierre Raybaut @@ -31,10 +31,11 @@ The following example is a good starting point to see how to set up a simple plot widget:: + from qtpy import QtWidgets as QW import qwt import numpy as np - app = qtpy.QtGui.QApplication([]) + app = QW.QApplication([]) x = np.linspace(-10, 10, 500) plot = qwt.QwtPlot("Trigonometric functions") plot.insertLegend(qwt.QwtLegend(), qwt.QwtPlot.BottomLegend) @@ -42,6 +43,7 @@ qwt.QwtPlotCurve.make(x, np.sin(x), "Sinus", plot, linecolor="blue", antialiased=True) plot.resize(600, 300) plot.show() + app.exec_() .. image:: https://raw.githubusercontent.com/PierreRaybaut/PythonQwt/master/doc/images/QwtPlot_example.png diff -Nru python-qwt-0.8.1/PythonQwt.egg-info/SOURCES.txt python-qwt-0.8.3/PythonQwt.egg-info/SOURCES.txt --- python-qwt-0.8.1/PythonQwt.egg-info/SOURCES.txt 2020-08-24 21:27:06.000000000 +0000 +++ python-qwt-0.8.3/PythonQwt.egg-info/SOURCES.txt 2020-08-31 08:26:03.000000000 +0000 @@ -9,7 +9,6 @@ PythonQwt.egg-info/entry_points.txt PythonQwt.egg-info/requires.txt PythonQwt.egg-info/top_level.txt -doc/PythonQwt.chm.zip doc/conf.py doc/index.rst doc/installation.rst diff -Nru python-qwt-0.8.1/qwt/__init__.py python-qwt-0.8.3/qwt/__init__.py --- python-qwt-0.8.1/qwt/__init__.py 2020-08-24 21:12:36.000000000 +0000 +++ python-qwt-0.8.3/qwt/__init__.py 2020-08-31 08:26:03.000000000 +0000 @@ -28,7 +28,7 @@ .. _GitHubPage: http://pierreraybaut.github.io/PythonQwt .. _GitHub: https://github.com/PierreRaybaut/PythonQwt """ -__version__ = "0.8.1" +__version__ = "0.8.3" QWT_VERSION_STR = "6.1.5" import warnings diff -Nru python-qwt-0.8.1/qwt/plot.py python-qwt-0.8.3/qwt/plot.py --- python-qwt-0.8.1/qwt/plot.py 2020-08-23 07:51:05.000000000 +0000 +++ python-qwt-0.8.3/qwt/plot.py 2020-08-31 08:26:03.000000000 +0000 @@ -234,10 +234,11 @@ The following example is a good starting point to see how to set up a plot widget:: + from qtpy import QtWidgets as QW import qwt import numpy as np - app = qtpy.QtGui.QApplication([]) + app = QW.QApplication([]) x = np.linspace(-10, 10, 500) plot = qwt.QwtPlot("Trigonometric functions") plot.insertLegend(qwt.QwtLegend(), qwt.QwtPlot.BottomLegend) diff -Nru python-qwt-0.8.1/qwt/tests/bodedemo.py python-qwt-0.8.3/qwt/tests/bodedemo.py --- python-qwt-0.8.1/qwt/tests/bodedemo.py 2020-08-23 07:40:07.000000000 +0000 +++ python-qwt-0.8.3/qwt/tests/bodedemo.py 2020-08-31 08:26:03.000000000 +0000 @@ -21,9 +21,9 @@ QHBoxLayout, QLabel, ) -from qtpy.QtGui import QPen, QBrush, QFont, QIcon, QPixmap +from qtpy.QtGui import QPen, QFont, QIcon, QPixmap from qtpy.QtPrintSupport import QPrinter, QPrintDialog -from qtpy.QtCore import QSize, Qt +from qtpy.QtCore import Qt from qwt import ( QwtPlot, QwtPlotMarker, @@ -279,7 +279,6 @@ if __name__ == "__main__": - from qwt.tests import test_widget - import os + from qwt import tests - app = test_widget(BodeDemo, (640, 480)) + tests.test_widget(BodeDemo, (640, 480)) diff -Nru python-qwt-0.8.1/qwt/tests/cartesian.py python-qwt-0.8.3/qwt/tests/cartesian.py --- python-qwt-0.8.1/qwt/tests/cartesian.py 2020-08-23 07:40:07.000000000 +0000 +++ python-qwt-0.8.3/qwt/tests/cartesian.py 2020-08-31 08:26:03.000000000 +0000 @@ -10,7 +10,6 @@ import numpy as np -from qtpy.QtGui import QPen from qtpy.QtCore import Qt from qwt import QwtPlot, QwtScaleDraw, QwtPlotGrid, QwtPlotCurve, QwtPlotItem @@ -101,6 +100,6 @@ if __name__ == "__main__": - from qwt.tests import test_widget + from qwt import tests - test_widget(CartesianPlot, (800, 480)) + tests.test_widget(CartesianPlot, (800, 480)) diff -Nru python-qwt-0.8.1/qwt/tests/cpudemo.py python-qwt-0.8.3/qwt/tests/cpudemo.py --- python-qwt-0.8.1/qwt/tests/cpudemo.py 2020-08-23 07:40:07.000000000 +0000 +++ python-qwt-0.8.3/qwt/tests/cpudemo.py 2020-08-31 08:26:03.000000000 +0000 @@ -25,9 +25,6 @@ QwtText, ) -TIMER_INTERVAL = 1000 -SHOW_ALL_CURVES = False - class CpuStat: User = 0 @@ -285,16 +282,14 @@ self.setBrush(c) -HISTORY = 60 - - class CpuPlot(QwtPlot): - def __init__(self, *args): + HISTORY = 60 + def __init__(self, *args, unattended=False): QwtPlot.__init__(self, *args) self.curves = {} self.data = {} - self.timeData = 1.0 * np.arange(HISTORY - 1, -1, -1) + self.timeData = 1.0 * np.arange(self.HISTORY - 1, -1, -1) self.cpuStat = CpuStat() self.setAutoReplot(False) @@ -307,7 +302,7 @@ self.setAxisTitle(QwtPlot.xBottom, "System Uptime [h:m:s]") self.setAxisScaleDraw(QwtPlot.xBottom, TimeScaleDraw(self.cpuStat.upTime())) - self.setAxisScale(QwtPlot.xBottom, 0, HISTORY) + self.setAxisScale(QwtPlot.xBottom, 0, self.HISTORY) self.setAxisLabelRotation(QwtPlot.xBottom, -50.0) self.setAxisLabelAlignment(QwtPlot.xBottom, Qt.AlignLeft | Qt.AlignBottom) @@ -324,35 +319,35 @@ curve.setColor(Qt.red) curve.attach(self) self.curves["System"] = curve - self.data["System"] = np.zeros(HISTORY, np.float) + self.data["System"] = np.zeros(self.HISTORY, np.float) curve = CpuCurve("User") curve.setColor(Qt.blue) curve.setZ(curve.z() - 1.0) curve.attach(self) self.curves["User"] = curve - self.data["User"] = np.zeros(HISTORY, np.float) + self.data["User"] = np.zeros(self.HISTORY, np.float) curve = CpuCurve("Total") curve.setColor(Qt.black) curve.setZ(curve.z() - 2.0) curve.attach(self) self.curves["Total"] = curve - self.data["Total"] = np.zeros(HISTORY, np.float) + self.data["Total"] = np.zeros(self.HISTORY, np.float) curve = CpuCurve("Idle") curve.setColor(Qt.darkCyan) curve.setZ(curve.z() - 3.0) curve.attach(self) self.curves["Idle"] = curve - self.data["Idle"] = np.zeros(HISTORY, np.float) + self.data["Idle"] = np.zeros(self.HISTORY, np.float) self.showCurve(self.curves["System"], True) self.showCurve(self.curves["User"], True) - self.showCurve(self.curves["Total"], False or SHOW_ALL_CURVES) - self.showCurve(self.curves["Idle"], False or SHOW_ALL_CURVES) + self.showCurve(self.curves["Total"], False or unattended) + self.showCurve(self.curves["Idle"], False or unattended) - self.startTimer(TIMER_INTERVAL) + self.startTimer(20 if unattended else 1000) legend.checked.connect(self.showCurve) self.replot() @@ -382,11 +377,11 @@ class CpuDemo(QWidget): - def __init__(self, parent=None): + def __init__(self, parent=None, unattended=False): super(CpuDemo, self).__init__(parent) layout = QVBoxLayout() self.setLayout(layout) - plot = CpuPlot() + plot = CpuPlot(unattended=unattended) plot.setTitle("History") layout.addWidget(plot) label = QLabel("Press the legend to en/disable a curve") @@ -394,9 +389,6 @@ if __name__ == "__main__": - from qwt.tests import test_widget + from qwt import tests - if os.environ.get("TEST_UNATTENDED") is not None: - SHOW_ALL_CURVES = True - TIMER_INTERVAL = 20 - app = test_widget(CpuDemo, (600, 400)) + app = tests.test_widget(CpuDemo, (600, 400)) diff -Nru python-qwt-0.8.1/qwt/tests/curvebenchmark1.py python-qwt-0.8.3/qwt/tests/curvebenchmark1.py --- python-qwt-0.8.1/qwt/tests/curvebenchmark1.py 2020-08-24 21:15:50.000000000 +0000 +++ python-qwt-0.8.3/qwt/tests/curvebenchmark1.py 2020-08-31 08:26:03.000000000 +0000 @@ -21,6 +21,7 @@ QLineEdit, ) from qtpy.QtCore import Qt +from qwt import tests import os @@ -133,7 +134,7 @@ TITLE = "Curve benchmark" SIZE = (1000, 500) - def __init__(self, max_n=1000000, parent=None, **kwargs): + def __init__(self, max_n=1000000, parent=None, unattended=False, **kwargs): super(CurveBenchmark1, self).__init__(parent=parent) title = self.TITLE if kwargs.get("only_lines", False): @@ -153,10 +154,7 @@ self.run_benchmark(max_n, **kwargs) dt = time.time() - t0g self.text.append("

Total elapsed time: %d ms" % (dt * 1e3)) - if os.environ.get("TEST_UNATTENDED") is None: - self.tabs.setCurrentIndex(0) - else: - self.tabs.setCurrentIndex(1) + self.tabs.setCurrentIndex(0 if unattended else 1) def process_iteration(self, title, description, widget, t0): self.tabs.addTab(widget, title) diff -Nru python-qwt-0.8.1/qwt/tests/curvebenchmark2.py python-qwt-0.8.3/qwt/tests/curvebenchmark2.py --- python-qwt-0.8.1/qwt/tests/curvebenchmark2.py 2020-08-23 07:40:07.000000000 +0000 +++ python-qwt-0.8.3/qwt/tests/curvebenchmark2.py 2020-08-31 08:26:03.000000000 +0000 @@ -10,8 +10,7 @@ import time -from qtpy.QtGui import QPen, QBrush -from qtpy.QtCore import QSize, Qt +from qtpy.QtCore import Qt from qwt.tests import curvebenchmark1 as cb @@ -64,8 +63,10 @@ TITLE = "Curve styles" SIZE = (1000, 800) - def __init__(self, max_n=1000, parent=None, **kwargs): - super(CurveBenchmark2, self).__init__(max_n=max_n, parent=parent, **kwargs) + def __init__(self, max_n=1000, parent=None, unattended=False, **kwargs): + super(CurveBenchmark2, self).__init__( + max_n=max_n, parent=parent, unattended=unattended, **kwargs + ) def run_benchmark(self, max_n, **kwargs): for points, symbols in zip( @@ -85,6 +86,6 @@ if __name__ == "__main__": - from qwt.tests import test_widget + from qwt import tests - app = test_widget(CurveBenchmark2, options=False) + tests.test_widget(CurveBenchmark2, options=False) diff -Nru python-qwt-0.8.1/qwt/tests/curvedemo1.py python-qwt-0.8.3/qwt/tests/curvedemo1.py --- python-qwt-0.8.1/qwt/tests/curvedemo1.py 2020-08-23 07:40:07.000000000 +0000 +++ python-qwt-0.8.3/qwt/tests/curvedemo1.py 2020-08-31 08:26:03.000000000 +0000 @@ -11,7 +11,7 @@ import numpy as np from qtpy.QtWidgets import QFrame -from qtpy.QtGui import QPen, QBrush, QFont, QPainter, QPaintEngine +from qtpy.QtGui import QPen, QBrush, QFont, QPainter from qtpy.QtCore import QSize, Qt from qwt import QwtSymbol, QwtPlotCurve, QwtPlotItem, QwtScaleMap @@ -119,6 +119,6 @@ if __name__ == "__main__": - from qwt.tests import test_widget + from qwt import tests - app = test_widget(CurveDemo1, size=(300, 600), options=False) + tests.test_widget(CurveDemo1, size=(300, 600), options=False) diff -Nru python-qwt-0.8.1/qwt/tests/curvedemo2.py python-qwt-0.8.3/qwt/tests/curvedemo2.py --- python-qwt-0.8.1/qwt/tests/curvedemo2.py 2020-08-23 07:40:07.000000000 +0000 +++ python-qwt-0.8.3/qwt/tests/curvedemo2.py 2020-08-31 08:26:03.000000000 +0000 @@ -119,6 +119,6 @@ if __name__ == "__main__": - from qwt.tests import test_widget + from qwt import tests - app = test_widget(CurveDemo2, options=False) + tests.test_widget(CurveDemo2, options=False) diff -Nru python-qwt-0.8.1/qwt/tests/data.py python-qwt-0.8.3/qwt/tests/data.py --- python-qwt-0.8.1/qwt/tests/data.py 2020-08-23 07:40:07.000000000 +0000 +++ python-qwt-0.8.3/qwt/tests/data.py 2020-08-31 08:26:03.000000000 +0000 @@ -23,11 +23,9 @@ QwtAbstractScaleDraw, ) -TIMER_INTERVAL = 50 - class DataPlot(QwtPlot): - def __init__(self, *args): + def __init__(self, *args, unattended=False): QwtPlot.__init__(self, *args) self.setCanvasBackground(Qt.white) @@ -62,7 +60,7 @@ self.setAxisTitle(QwtPlot.xBottom, "Time (seconds)") self.setAxisTitle(QwtPlot.yLeft, "Values") - self.startTimer(TIMER_INTERVAL) + self.startTimer(10 if unattended else 50) self.phase = 0.0 def alignScales(self): @@ -98,9 +96,6 @@ if __name__ == "__main__": - from qwt.tests import test_widget - import os + from qwt import tests - if os.environ.get("TEST_UNATTENDED") is not None: - TIMER_INTERVAL = 10 - app = test_widget(DataPlot, size=(500, 300)) + app = tests.test_widget(DataPlot, size=(500, 300)) diff -Nru python-qwt-0.8.1/qwt/tests/errorbar.py python-qwt-0.8.3/qwt/tests/errorbar.py --- python-qwt-0.8.1/qwt/tests/errorbar.py 2020-08-23 07:40:07.000000000 +0000 +++ python-qwt-0.8.3/qwt/tests/errorbar.py 2020-08-31 08:26:03.000000000 +0000 @@ -307,6 +307,6 @@ if __name__ == "__main__": - from qwt.tests import test_widget + from qwt import tests - app = test_widget(ErrorBarPlot, size=(640, 480)) + tests.test_widget(ErrorBarPlot, size=(640, 480)) diff -Nru python-qwt-0.8.1/qwt/tests/eventfilter.py python-qwt-0.8.3/qwt/tests/eventfilter.py --- python-qwt-0.8.1/qwt/tests/eventfilter.py 2020-08-23 07:40:07.000000000 +0000 +++ python-qwt-0.8.3/qwt/tests/eventfilter.py 2020-08-31 08:26:03.000000000 +0000 @@ -472,6 +472,6 @@ if __name__ == "__main__": - from qwt.tests import test_widget + from qwt import tests - app = test_widget(EventFilterWindow, size=(540, 400)) + tests.test_widget(EventFilterWindow, size=(540, 400)) diff -Nru python-qwt-0.8.1/qwt/tests/image.py python-qwt-0.8.3/qwt/tests/image.py --- python-qwt-0.8.1/qwt/tests/image.py 2020-08-23 07:40:07.000000000 +0000 +++ python-qwt-0.8.3/qwt/tests/image.py 2020-08-31 08:26:03.000000000 +0000 @@ -196,6 +196,6 @@ if __name__ == "__main__": - from qwt.tests import test_widget + from qwt import tests - app = test_widget(ImagePlot, size=(600, 400)) + tests.test_widget(ImagePlot, size=(600, 400)) diff -Nru python-qwt-0.8.1/qwt/tests/__init__.py python-qwt-0.8.3/qwt/tests/__init__.py --- python-qwt-0.8.1/qwt/tests/__init__.py 2020-08-23 07:40:07.000000000 +0000 +++ python-qwt-0.8.3/qwt/tests/__init__.py 2020-08-31 08:26:03.000000000 +0000 @@ -16,40 +16,31 @@ import sys import subprocess import platform -from qtpy.QtWidgets import ( - QApplication, - QWidget, - QMainWindow, - QVBoxLayout, - QFormLayout, - QCheckBox, - QGroupBox, - QGridLayout, - QToolButton, - QStyle, - QToolBar, - QAction, - QMessageBox, -) -from qtpy.QtGui import QIcon, QPixmap -from qtpy.QtCore import Qt, QSize, QTimer -from qtpy import PYQT5 +import argparse +import inspect + +from qtpy import QtWidgets as QW +from qtpy import QtGui as QG +from qtpy import QtCore as QC +from qtpy import PYQT5, PYSIDE2 + from qwt import QwtPlot +if PYSIDE2: + import PySide2 -TEST_PATH = osp.abspath(osp.dirname(__file__)) + PYTHON_QT_API = "PySide2 v" + PySide2.__version__ +elif PYQT5: + from PyQt5.QtCore import PYQT_VERSION_STR + + PYTHON_QT_API = "PyQt5 v" + PYQT_VERSION_STR +else: + from PyQt4.QtCore import PYQT_VERSION_STR + PYTHON_QT_API = "PyQt4 v" + PYQT_VERSION_STR -def run_test(fname, wait=False): - """Run test""" - os.environ["PYTHONPATH"] = os.pathsep.join(sys.path) - args = " ".join([sys.executable, '"' + fname + '"']) - if os.environ.get("TEST_UNATTENDED") is not None: - print(args) - if wait: - subprocess.call(args, shell=True) - else: - subprocess.Popen(args, shell=True) + +TEST_PATH = osp.abspath(osp.dirname(__file__)) def get_tests(package): @@ -74,7 +65,16 @@ return tests -def run_all_tests(wait): +def run_test(fname, wait=True): + """Run test""" + os.environ["PYTHONPATH"] = os.pathsep.join(sys.path) + args = " ".join([sys.executable, '"' + fname + '"']) + if TestEnvironment().unattended: + print(" " + args) + (subprocess.call if wait else subprocess.Popen)(args, shell=True) + + +def run_all_tests(wait=True): """Run all PythonQwt tests""" import qwt @@ -82,7 +82,7 @@ run_test(fname, wait=wait) -class TestLauncher(QMainWindow): +class TestLauncher(QW.QMainWindow): """PythonQwt Test Launcher main window""" ROWS = 5 @@ -94,8 +94,8 @@ self.setObjectName("TestLauncher") self.setWindowIcon(self.get_std_icon("FileDialogListView")) self.setWindowTitle("PythonQwt %s - Test Launcher" % __version__) - self.setCentralWidget(QWidget()) - self.grid_layout = QGridLayout() + self.setCentralWidget(QW.QWidget()) + self.grid_layout = QW.QGridLayout() self.centralWidget().setLayout(self.grid_layout) self.test_nb = None self.fill_layout() @@ -104,7 +104,7 @@ def get_std_icon(self, name): """Return Qt standard icon""" - return self.style().standardIcon(getattr(QStyle, "SP_" + name)) + return self.style().standardIcon(getattr(QW.QStyle, "SP_" + name)) def fill_layout(self): """Fill grid layout""" @@ -112,15 +112,15 @@ for fname in get_tests(qwt): self.add_test(fname) - toolbar = QToolBar(self) - all_act = QAction(self.get_std_icon("DialogYesButton"), "", self) + toolbar = QW.QToolBar(self) + all_act = QW.QAction(self.get_std_icon("DialogYesButton"), "", self) all_act.setIconText("Run all tests") all_act.triggered.connect(lambda checked: run_all_tests(wait=False)) - folder_act = QAction(self.get_std_icon("DirOpenIcon"), "", self) + folder_act = QW.QAction(self.get_std_icon("DirOpenIcon"), "", self) folder_act.setIconText("Open tests folder") open_test_folder = lambda checked: os.startfile(TEST_PATH) folder_act.triggered.connect(open_test_folder) - about_act = QAction(self.get_std_icon("FileDialogInfoView"), "", self) + about_act = QW.QAction(self.get_std_icon("FileDialogInfoView"), "", self) about_act.setIconText("About") about_act.triggered.connect(self.about) for action in (all_act, folder_act, None, about_act): @@ -128,7 +128,7 @@ toolbar.addSeparator() else: toolbar.addAction(action) - toolbar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) + toolbar.setToolButtonStyle(QC.Qt.ToolButtonTextBesideIcon) self.addToolBar(toolbar) def add_test(self, fname): @@ -139,16 +139,16 @@ row = (self.test_nb - 1) % self.ROWS column = (self.test_nb - 1) // self.ROWS bname = osp.basename(fname) - button = QToolButton(self) - button.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) + button = QW.QToolButton(self) + button.setToolButtonStyle(QC.Qt.ToolButtonTextUnderIcon) shot = osp.join(TEST_PATH, "data", bname.replace(".py", ".png")) if osp.isfile(shot): - button.setIcon(QIcon(shot)) + button.setIcon(QG.QIcon(shot)) else: button.setIcon(self.get_std_icon("DialogYesButton")) button.setText(bname) button.setToolTip(fname) - button.setIconSize(QSize(130, 80)) + button.setIconSize(QC.QSize(130, 80)) button.clicked.connect(lambda checked=None, fname=fname: run_test(fname)) self.grid_layout.addWidget(button, row, column) @@ -156,53 +156,40 @@ """About test launcher""" from qtpy.QtCore import __version__ as qt_version - QMessageBox.about( + QW.QMessageBox.about( self, "About " + self.windowTitle(), """%s

Developped by Pierre Raybaut
Copyright © 2020 Pierre Raybaut -

Python %s, Qt %s on %s""" +

Python %s, Qt %s, %s on %s""" % ( self.windowTitle(), platform.python_version(), qt_version, + PYTHON_QT_API, platform.system(), ), ) -def run(wait=True): - """Run PythonQwt tests or test launcher (requires `guidata`)""" - app = QApplication([]) - launcher = TestLauncher() - launcher.show() - unattended = os.environ.get("TEST_UNATTENDED") is not None - if unattended: - QTimer.singleShot(100, lambda: take_screenshot(launcher)) - app.exec_() - launcher.close() - if unattended: - run_all_tests(wait=wait) - - -class TestOptions(QGroupBox): +class TestOptions(QW.QGroupBox): """Test options groupbox""" def __init__(self, parent=None): super(TestOptions, self).__init__("Test options", parent) - self.setLayout(QFormLayout()) + self.setLayout(QW.QFormLayout()) self.hide() def add_checkbox(self, title, label, slot): """Add new checkbox to option panel""" - widget = QCheckBox(label, self) + widget = QW.QCheckBox(label, self) widget.stateChanged.connect(slot) self.layout().addRow(title, widget) self.show() return widget -class TestCentralWidget(QWidget): +class TestCentralWidget(QW.QWidget): """Test central widget""" def __init__(self, widget_name, parent=None): @@ -210,7 +197,7 @@ self.widget_name = widget_name self.plots = None self.widget_of_interest = self.parent() - self.setLayout(QVBoxLayout()) + self.setLayout(QW.QVBoxLayout()) self.options = TestOptions(self) self.add_widget(self.options) @@ -238,24 +225,29 @@ if PYQT5: pixmap = widget.grab() else: - pixmap = QPixmap.grabWidget(widget) + pixmap = QG.QPixmap.grabWidget(widget) bname = (widget.objectName().lower() + ".png").replace("window", "") bname = bname.replace("plot", "").replace("widget", "") pixmap.save(osp.join(TEST_PATH, "data", bname)) - QTimer.singleShot(0, QApplication.instance().quit) + QC.QTimer.singleShot(0, QW.QApplication.instance().quit) -def test_widget(widget_class, size=None, title=None, options=True, timeout=1000): +def test_widget(widget_class, size=None, title=None, options=True): """Test widget""" widget_name = widget_class.__name__ - app = QApplication([]) - window = widget = widget_class() + app = QW.QApplication([]) + test_env = TestEnvironment() + if inspect.signature(widget_class).parameters.get("unattended") is None: + widget = widget_class() + else: + widget = widget_class(unattended=test_env.unattended) + window = widget if options: - if isinstance(widget, QMainWindow): + if isinstance(widget, QW.QMainWindow): widget = window.centralWidget() widget.setParent(None) else: - window = QMainWindow() + window = QW.QMainWindow() central_widget = TestCentralWidget(widget_name, parent=window) central_widget.add_widget(widget) window.setCentralWidget(central_widget) @@ -273,11 +265,73 @@ window.resize(width, height) window.show() - if os.environ.get("TEST_UNATTENDED") is not None: - QTimer.singleShot(timeout, lambda: take_screenshot(widget_of_interest)) + if test_env.screenshots: + QC.QTimer.singleShot(1000, lambda: take_screenshot(widget_of_interest)) + elif test_env.unattended: + QC.QTimer.singleShot(0, QW.QApplication.instance().quit) app.exec_() return app +class TestEnvironment(object): + UNATTENDED_ARG = "unattended" + SCREENSHOTS_ARG = "screenshots" + UNATTENDED_ENV = "PYTHONQWT_UNATTENDED_TESTS" + SCREENSHOTS_ENV = "PYTHONQWT_TAKE_SCREENSHOTS" + + def __init__(self): + self.parse_args() + + @property + def unattended(self): + return os.environ.get(self.UNATTENDED_ENV) is not None + + @property + def screenshots(self): + return os.environ.get(self.SCREENSHOTS_ENV) is not None + + def parse_args(self): + """Parse command line arguments""" + parser = argparse.ArgumentParser(description="Run PythonQwt tests") + parser.add_argument( + "--mode", + choices=[self.UNATTENDED_ARG, self.SCREENSHOTS_ARG], + required=False, + ) + args = parser.parse_args() + if args.mode is not None: + self.set_env_from_args(args) + + def set_env_from_args(self, args): + """Set appropriate environment variables""" + for name in (self.UNATTENDED_ENV, self.SCREENSHOTS_ENV): + if name in os.environ: + os.environ.pop(name) + if args.mode == self.UNATTENDED_ARG: + os.environ[self.UNATTENDED_ENV] = "1" + if args.mode == self.SCREENSHOTS_ARG: + os.environ[self.SCREENSHOTS_ENV] = os.environ[self.UNATTENDED_ENV] = "1" + + +def run(wait=True): + """Run PythonQwt tests or test launcher""" + app = QW.QApplication([]) + launcher = TestLauncher() + launcher.show() + test_env = TestEnvironment() + if test_env.screenshots: + print("Running PythonQwt tests and taking screenshots automatically:") + print("-------------------------------------------------------------") + QC.QTimer.singleShot(100, lambda: take_screenshot(launcher)) + elif test_env.unattended: + print("Running PythonQwt tests in unattended mode:") + print("-------------------------------------------") + QC.QTimer.singleShot(0, QW.QApplication.instance().quit) + app.exec_() + launcher.close() + if test_env.unattended: + run_all_tests(wait=wait) + + if __name__ == "__main__": run() diff -Nru python-qwt-0.8.1/qwt/tests/logcurve.py python-qwt-0.8.3/qwt/tests/logcurve.py --- python-qwt-0.8.1/qwt/tests/logcurve.py 2020-08-23 07:40:07.000000000 +0000 +++ python-qwt-0.8.3/qwt/tests/logcurve.py 2020-08-31 08:26:03.000000000 +0000 @@ -12,7 +12,6 @@ np.seterr(all="raise") -from qtpy.QtGui import QPen from qtpy.QtCore import Qt from qwt import QwtPlot, QwtPlotCurve, QwtLogScaleEngine @@ -31,6 +30,6 @@ if __name__ == "__main__": - from qwt.tests import test_widget + from qwt import tests - app = test_widget(LogCurvePlot, size=(800, 500)) + tests.test_widget(LogCurvePlot, size=(800, 500)) diff -Nru python-qwt-0.8.1/qwt/tests/mapdemo.py python-qwt-0.8.3/qwt/tests/mapdemo.py --- python-qwt-0.8.1/qwt/tests/mapdemo.py 2020-08-23 07:40:07.000000000 +0000 +++ python-qwt-0.8.3/qwt/tests/mapdemo.py 2020-08-31 08:26:03.000000000 +0000 @@ -96,6 +96,6 @@ if __name__ == "__main__": - from qwt.tests import test_widget + from qwt import tests - app = test_widget(MapDemo, size=(600, 600)) + tests.test_widget(MapDemo, size=(600, 600)) diff -Nru python-qwt-0.8.1/qwt/tests/multidemo.py python-qwt-0.8.3/qwt/tests/multidemo.py --- python-qwt-0.8.1/qwt/tests/multidemo.py 2020-08-23 07:40:07.000000000 +0000 +++ python-qwt-0.8.3/qwt/tests/multidemo.py 2020-08-31 08:26:03.000000000 +0000 @@ -70,6 +70,6 @@ if __name__ == "__main__": - from qwt.tests import test_widget + from qwt import tests - app = test_widget(MultiDemo, size=(400, 300)) + tests.test_widget(MultiDemo, size=(400, 300)) diff -Nru python-qwt-0.8.1/qwt/tests/simple.py python-qwt-0.8.3/qwt/tests/simple.py --- python-qwt-0.8.1/qwt/tests/simple.py 2020-08-23 07:40:07.000000000 +0000 +++ python-qwt-0.8.3/qwt/tests/simple.py 2020-08-31 08:26:03.000000000 +0000 @@ -52,6 +52,6 @@ if __name__ == "__main__": - from qwt.tests import test_widget + from qwt import tests - app = test_widget(SimplePlot, size=(600, 400)) + tests.test_widget(SimplePlot, size=(600, 400)) diff -Nru python-qwt-0.8.1/qwt/tests/vertical.py python-qwt-0.8.3/qwt/tests/vertical.py --- python-qwt-0.8.1/qwt/tests/vertical.py 2020-08-23 07:40:07.000000000 +0000 +++ python-qwt-0.8.3/qwt/tests/vertical.py 2020-08-31 08:26:03.000000000 +0000 @@ -10,7 +10,7 @@ import numpy as np -from qtpy.QtGui import QFont, QPen, QPalette, QColor +from qtpy.QtGui import QPen, QPalette, QColor from qtpy.QtCore import Qt import os @@ -97,6 +97,6 @@ if __name__ == "__main__": - from qwt.tests import test_widget + from qwt import tests - app = test_widget(VerticalPlot, size=(300, 650)) + tests.test_widget(VerticalPlot, size=(300, 650)) diff -Nru python-qwt-0.8.1/README.md python-qwt-0.8.3/README.md --- python-qwt-0.8.1/README.md 2020-08-24 21:10:51.000000000 +0000 +++ python-qwt-0.8.3/README.md 2020-08-31 08:26:03.000000000 +0000 @@ -55,10 +55,16 @@ tests.run() ``` -or from the command line: +or from the command line (script name depends on Python major version number): ```bash -PythonQwt-tests +PythonQwt-py3 +``` + +Tests may also be executed in unattended mode: + +```bash +PythonQwt-tests-py3 --mode unattended ``` ## Overview diff -Nru python-qwt-0.8.1/setup.py python-qwt-0.8.3/setup.py --- python-qwt-0.8.1/setup.py 2020-08-24 21:20:32.000000000 +0000 +++ python-qwt-0.8.3/setup.py 2020-08-31 08:26:03.000000000 +0000 @@ -51,10 +51,11 @@ The following example is a good starting point to see how to set up a simple plot widget:: + from qtpy import QtWidgets as QW import qwt import numpy as np - app = qtpy.QtGui.QApplication([]) + app = QW.QApplication([]) x = np.linspace(-10, 10, 500) plot = qwt.QwtPlot("Trigonometric functions") plot.insertLegend(qwt.QwtLegend(), qwt.QwtPlot.BottomLegend) @@ -62,6 +63,7 @@ qwt.QwtPlotCurve.make(x, np.sin(x), "Sinus", plot, linecolor="blue", antialiased=True) plot.resize(600, 300) plot.show() + app.exec_() .. image:: https://raw.githubusercontent.com/PierreRaybaut/PythonQwt/master/doc/images/QwtPlot_example.png @@ -114,8 +116,11 @@ extras_require={"Doc": ["Sphinx>=1.1"],}, entry_points={ "gui_scripts": [ + "PythonQwt-py%d = qwt.tests:run [Tests]" % sys.version_info.major, + ], + "console_scripts": [ "PythonQwt-tests-py%d = qwt.tests:run [Tests]" % sys.version_info.major, - ] + ], }, author="Pierre Raybaut", author_email="pierre.raybaut@gmail.com",